beginnerPython
What are variables in Python?
Answer
Clear, interview-ready explanation
A variable is a name that refers to an object or value in memory. Python creates a variable when a value is assigned to it, so its data type does not need to be declared explicitly.
name = "Aman"
age = 25
salary = 45000.50
Here:
-
namerefers to a string. -
agerefers to an integer. -
salaryrefers to a floating-point number.
Python also supports multiple assignment:
name, age, country = "Aman", 25, "India"
Variable names are case-sensitive, so and age are different variables.
Age