Get the full source code of application here:
Show More Show Less View Video Transcript
0:00
uh hello guys welcome to this video so
0:02
in this video I will show you a very
0:04
simple program in Python to add two
0:07
numbers and print out the result in the
0:09
terminal so it's a very beginner
0:11
friendly programming tutorial inside
0:13
Python if you haven't programmed before
0:15
in Python this will be a complete
0:17
beginner tutorial so for this you should
0:19
have Python installed on your terminal
0:22
if you haven't then simply install
0:24
Python i having the latest version of
0:26
Python you can see 3.10.5 in
0:29
10.5 so now the way by which you can
0:34
actually create a
0:36
program it's very simple unlike other
0:39
programming languages python is very
0:41
simple when it comes to simply create a
0:44
app py file and right here you
0:49
simply in order to add two numbers we
0:52
need to declare variables where we can
0:54
store something so I will say a is equal
0:58
to 5 so this is by which we can declare
1:01
variables in python so essentially we
1:04
are giving the value five to this
1:07
variable a is equal to 5 similarly we
1:10
can declare another variable b is equal
1:12
to
1:13
5 so here as you know unlike other
1:16
programming languages you need to
1:18
mention the data type let's suppose if
1:20
you're declaring integer you need to
1:22
specify here int but in Python you don't
1:25
need to do this that's why it's very
1:28
simple now to actually add these two
1:31
numbers what we can do we can directly
1:33
write
1:34
this print out the result like a + b
1:39
very simple so this will add these two
1:42
numbers and print out the result
1:43
directly to the terminal so if I execute
1:45
this Python program you will
1:47
see it will print out 5 + 5 comes out to
1:51
be 10 so 10 is printed out uh there is
1:55
another way that you can do you can
1:57
declare a third variable and then just
2:00
store this addition inside this third
2:03
variable and then print out the
2:08
result so both these approaches are will
2:12
yield the same result you will see 10 is
2:14
printed out so this is a very basic
2:17
addition of two numbers program inside
2:19
Python you first of all declare these
2:21
two
2:22
variables then store the result a + b
2:26
and then print it out so very simple in
2:29
this way you can subtract as well 5 + 5
2:34
comes out to be zero so this operator
2:37
can be anything multiplication divide
2:41
anything so this is essentially the
2:44
program here inside Python you will see
2:47
that it's very
2:49
simple we don't need to specify the data
2:52
type we can directly declare variables
2:54
and then we can print out this result so
2:57
in this easy way you can add make this
3:00
program of addition of two numbers uh
3:03
thank you very much for watching this
3:05
video and also check out my website
3:08
freemediattools.com
3:09
uh which contains uh thousands of tools
