Python Code To Add Two Numbers
Hello guys....
Welcome to my blog. Today I am going to teach you how to Add Two Numbers using Python language. Python language is really easy to understand and can be mastered very easily in a very short time... For more detailed view of the code and tutorial, please visit my YouTube channel - TechnoStar.
In my YouTube channel I will be teaching different computer languages and giving informative details of technology and this helps many people in seveldevelvwry good programming ability in them.
Before becoming a good programmer, you need to have a good logical on how you can tackle a given problem very easily. By mastering logical thinking, you can create any type application using any computer language. The logic part is the main basic requirements of a efficient programmer and to become successful in the field of programming...
So this was a small detailed instructions...
So now let's start to code in Python language to add 2 numbers... The basic adding and other mathematical operatinons and conditions and functions are all same in all the language, only the synatx and the wordings are different in different languages. So never be disappointed by any other computer language that you don't know and your friend has mastered it... I am here to teach you guys how to become a successful programmer in life.. . So subscribe my YouTube channel....
www.youtube.com/technostar19
Link to video of this tutorial video...
https://youtu.be/qKdbiXJ3618
So here is the code...
For single number...
Syntax :
variable1=value
variable2=value
variable3=float(variable1)+float(variable2)
(Or)
variable3=num(variable1)+num(variable2)
print('The sum of {0} and {1} is {2} is ',format(variable1, variable2, variable3))
Ex :
num1=25
num2=50
sum=float(num1)+float(num2)
print (' the sum of {0} and {1} is {2}', format ( num1,num2,sum))
Here variable1=num1
variable2=num2
variable3=sum
For inputting of two numbers....
Syntax :
variable1=input('sentence or string')
variable2=input ('sentence or string')
variable3=float(variable1)+float (variable2)
print('samw sentence as in above',format(variable1, variable2, variable3))
Ex :
num1=input('Enter the first number: ')
nun2=input(''Enter the second number: ')
sum=float(num1)+float (num2)
print('The sum of {0} and {1} is {2} ',format(nun1,num2,sum))
This is the code to add two numbers in two different ways....
Explanation of the code...
First you need to create a variable normally and allocate a value to it. Then add those numbers using normal addition process....
By following my YouTube channel and this blog you can master python lalanguage in a very short time .... If you have any doubts, then you can add it in the comment section either in this blog or in my YouTube channel....
Thank you for reading patiently...
Have a successful life ahead in your future...
Wishing you all the best from your career...


Comments
Post a Comment