Articles → Python → Variables In Python
Variables In Python
What Are The Variables?
How To Declare A Variable?
- Specifying the variable name
- Followed by assignment operator i.e., ‘=’
- Followed by value
Multiple Assignments Of Variables In Python
x= y = z = 2
print(x,y,z)
x= y = z = 2
x = x + 1
print(x,y,z)
Declaring Multiple Variables In One Line
width, height = 20,40
print("width:",width)
print("height:",height)
Rules Of Creating Variables
- Variable names are case-sensitive
- Variable names should only contain alphabet, numbers, and underscore
- Keywords should not be used as the variable name
- Variable names should start with the alphabet or underscore