Variables#

A variable is a container for storing data.

Variables are made up of an identifier and a value. The identifier is the name, and the value is the data that is holds.

To create a variable simply assign a value to it it, using the = operator.

Listing 47 The identifiers are x and name.#
x = 5
name = "John"

To reference a variable, or retrieve the data you stored, use the variable name.

y = x + 3
print("Hello", name)