Adding Variables in Python…

•

How to Add Variables In Python…

In previous post we see how to assign values to a variables…

So in todays post we will see how to add two different variables with each other…

Adding Integer Numbers..

First we declared two variables and assign integer values to it..

Now we add these variables using additional operator and assign their additional value to new operator which stores the final value..

dont’t worry result is a variable name you give any name to your variable…

Now print the value stored in “result” variable…

Adding Floating Numbers..

So now we try to add some float numbers… Now Copying the above commands but now changing the integer values to float values(decimal)

a = 3.5
b = 4.5
result = a+b
print(result)

Adding String Characters…

So now we try to add some characters to variables… Now Copying the above commands but now changing the integer values to string values. At this time code is little bit different..

a = "John"
b = "Wick"
result = a+b
print(result)

Thank You for your visit..!

If you like post plzz comment for your support..!

Leave a Reply

Your email address will not be published. Required fields are marked *