So far, you've learnt a number of important concepts in Python. We've looked at numbers, expressions, strings, functions, objects and methods, type conversion and even escaping characters within a string!
In this tutorial, you'll learn about variables in Python. Let's get started!
Variables are used to store values. A good analogy for the variable is a box. You can imagine the name of the variable as the label on the box, and the value of the variable as what's stored inside it. Let's create a variable called name and put the value CommonLounge inside it.
type=codeblock|id=py3_variable|autocreate=python3name = "CommonLounge"print(name)
The above is equivalent to saying: Store the value "CommonLounge" in variable name
As you may have noticed, we did print(name) instead of print("name"). The first one (without the quotes) says, print the value of the variable name. The second one (with the quotes) says, print the string "name".
Yippee! You now have your first variable! :)