Skip to content
Foxipa

Suggest an edit

Tell us what should be corrected, clarified, or improved. Submission will be connected to Foxipa’s contribution service later.

No information is sent anywhere yet. Your suggestion is only prepared in your browser.

Learning

Python Variables and Values

Learn how Python names values and see the program output from an editable example running in your browser.

Levels: Beginner ~12 min read

Basic

In Python, assigning a value to a name creates a binding that your program can use later. Python does not require a separate declaration keyword for ordinary variables.

python
language = "Python"
learners = 1
learners += 1

print(language)
print(learners)

Edit and run the example

Change the values or add another print statement, then run the example. The Python runtime executes the code in a worker so the page interface remains responsive while Python initializes or runs.

Interactive Runnable example
Edit

Ready to run.

What to notice

  • A name can be assigned directly to a value.

  • The += operator updates the value bound to the name.

  • The print() function writes text to the runnable example output.

Was this page helpful?

Mark this learning resource complete to track your learning progress.