Juan
asked

Expert
Kelish Rai answered
No, you don't need always quotation marks when creating variables. For example,
age = 25In this case, age is a variable that stores the value 25. Since 25 is a number, we don't need to use quotation marks around it.
However, if you're storing a string in a variable, you must enclose the value with quotation marks. For example,
favorite_food = "Pizza"Here, favorite_food is a variable, storing the string "Pizza".
As for spaces around the equal sign, Python doesn’t require them, but adding spaces makes the code easier to read:
age=25
age = 25Here, age=25 works but age = 25 is cleaner and easier to understand.
Python
This question was asked as part of the Getting started with Python course.
Our Experts
Sudip BhandariHead of Growth/Marketing
Apekchhya ShresthaSenior Product Manager
Kelish RaiTechnical Content Writer
Abhilekh GautamSystem Engineer
Palistha SinghTechnical Content Writer
Sarthak BaralSenior Content Editor
Saujanya Poudel
Abhay Jajodia
Nisha SharmaTechnical Content Writer
Udayan ShakyaTechnical Content Writer