Python Variables

Store and reuse values with clear names.

Python
name = "Ada"
score = 91
print(name, score)
Output
Ada 91

Explanation

A variable gives a value a name. Python creates it when you assign with =. Names are case sensitive, and a later assignment can replace the value.

Explore the dry run
Guided walkthroughReady
1name = "Ada"
2score = 91
3print(name, score)

Follow the example

Start to inspect the source, values, and output. These prepared steps explain the published sample; grouped loop steps describe multiple iterations.

View the complete dry-run table
Prepared trace of the published program. Some rows group repeated iterations.
Step / lineWhat happensState after stepOutput so far
Assign the string Ada to name.name = "Ada"
—
Assign the integer 91 to score.name = "Ada", score = 91
—
Read both variables and send them to print.name = "Ada", score = 91
Ada 91