Variables

Lesson Progress
0% Complete

Variables in Python are assigned in the format name = value, where the variable’s name is on the left side of an equal sign and its value is to the right. Let’s take a look at how this works in practice.

x = 37

The above code creates a variable x with an integer value of 37. When x is referred to later in the code, the number 37 will be retrieved. See the below example conducted in the Python interpreter where x is set and then called.

>>> x = 37
>>> x
37