Python variable type
In this chapter we learn python veritable and you can store integers, decimals or characters in these variables.
Creating Python variable
The equal sign(=) used to assign value to variables.
Python variables do not need explicit declaration to reserve memory space.
X=1 Y="Mac" print(X) print(Y)Result:
Run Example »
Variable start with letter and underscore character.
Variable can't started with number
Variable names are case-sensitive (age, Age and AGE are three different variables)
More advance example variable
The Python print statement is often used to output variables.
combined with text and variable
print("Python is + X")
If you combine with a string and a number what will be answer
x = 2 y = "Mac" print(x + y)Try it yourself »