You are currently viewing How to use variables In Python?

How to use variables In Python?

Python is very intelligent, in python, there is no need to define the data type of variable, simply you can assign the value to a variable by value it will recognize its data type.

Example:       

a=10   // Python will take it as an integer value

b="10" // Python will take it as string value

Here only we are assigning the value we are not declaring the variable data type.

 

Example 2:  Now we will create the simple Program to add two number to clear our variable thing.

a=10

b=20

c=a+b

print(c)

output: 30

Here we only define the value, not the data type.

Important: There is no need to terminate the line by putting semicolon which we do in another programming language. Like PHP, java,c ,c++

Leave a Reply