Variable (Python)

A variable in Python is a name that points to a value stored in memory. You create one with the equals sign, and Python figures out the type automatically.

Python

Python variables don't need to be declared with a type ahead of time. Assigning a value both creates the variable and gives it a type, and you can reassign it to a value of a different type later.

Syntax

name = value

Examples

Python

age = 25
name = "Maya"
age = age + 1
print(name, age)

Output:

Maya 26

Learn it in a lesson

See also

Back to the Dictionary