Locked lesson.
About this lesson
In this lesson, we'll discuss how to store data within your program using variables and how to display them using the Print() command.
Exercise files
Download this lesson’s related exercise files.
7 - Variables.docx60.5 KB 7 - Variables SOLUTION.docx
55.4 KB
Quick reference
Python Variables and Print()
Variables are containers used to hold things like text, numbers, lists, tuples, and many other things.
When to use
Use them whenever you need to store data in your program.
Instructions
To create a variable, just name it and assign some data to it:
first_name = "John"
or
favorite_number = 41
To print out variables, just reference them in a print statement:
print(first_name)
Hints & tips
- first_name = "John"
- favorite_number = 41
- print(first_name)
Lesson notes are only available for subscribers.