If you are learning Python, and you are a beginner, after making Hello world program in Python.
print("Hello world")
You should perform basic computations like addition, multiplication, subtraction and division.
Addition of Two Numbers in Python-
See the program for addition of two numbers.
a=12
b=4
c=a+b
print(c)
Output would be 16
In the above code
a refers to 12 i.e. wherever a will be used value is 12.
b refers to 4 i.e. wherever 4 will be used value is 4.
c refers addition of a and b i.e. 16.
print(c) statement will send value of c on the standard output screen.
Multiplication of Two Numbers in Python-
To multiply a and b in the above program replace a+b by a*b, see the below program.
a=12
b=4
c=a*b
print(c)
Subtraction of a Number from Another Number in Python-
To subtract b from a, in the above program replace a*b by a-b, see the below program.
a=12
b=4
c=a-b
print(c)
Output would be 8.
Division of a Number by Another Number in Python-
To divide a by b, in the above program replace a-b by a/b, see the below program.
a=12
b=4
c=a/b
print(c)
The output would be 3.
In the video given below every thing is explained, watch the video.