-
Book Overview & Buying
-
Table Of Contents
Python Illustrated
By :
You might wonder, okay, variables are something. But what? Variables are like little containers with labels on them. In those containers, you can store a piece of data that you’ll need later. You can retrieve the piece of data later, using the label of the container.

Let’s say that we want to do a basic calculation, perhaps calculating the surface of a square. How do we calculate that? Well, we grab the length of the side and multiply that by itself. If we have a square with a length of 5 cm, we’ll say the surface is 5 * 5. If the length is 100 cm, the surface is 100 * 100.
Where am I going with this? Well, you could say that the formula for calculating the surface is side * side.
And if we want to write that in Python, we could create a variable for side. Remember, a variable is a little container with the actual value in it. The label of the container would be side, and we can store a value in it. Here’s how you’...