June 2017
Beginner to intermediate
274 pages
6h 49m
English
The second major building block of a Python program is called a variable. A variable is pretty much just a box for storing a data value. The variable has a name and we can use that name to access the data stored in the variable or to replace the data with a new value.
The function parameters in the previous examples were variables, as was area:
(name, radius):
To set the data stored in a variable, we use an assignment statement. An assignment is a statement, so remember this means that it can't be combined with any other statement. It gets a line of source code all for itself and the expressions that are part of it.
An assignment statement consists of the variable's name on the left-hand side of an equal to symbol and the value ...
Read now
Unlock full access