Articles → Python → Variables in python

Variables in python






What are the variables?





How to declare a variable?












name = "gyan"
age = 30



Multiple assignment of variables in python




x= y = z = 2

print(x,y,z)




Picture showing the output of Multiple assignment of variables in python

Click to Enlarge



x= y = z = 2
x = x + 1
print(x,y,z)




Picture showing the output of Multiple assignment of variables in python

Click to Enlarge




Declaring multiple variables in one line




width, height = 20,40

print("width:",width)
print("height:",height)




Picture showing the output of Declaring multiple variables in one line

Click to Enlarge


Rules of creating variables













Posted By  -  Karan Gupta
 
Posted On  -  Thursday, January 31, 2019
 
Updated On  -  Tuesday, March 26, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250