manyspikes

Defining variables

Initialising environment...

Whatever project you will work on in the future, it will involve some form of data, such as numbers or text. These data need to be organized appropriately, so you can make use of it when you need it. For instance, in spreadsheets you organise data in different cells, and then refer to that data using the cell coordinates. In Python, you organise data with variables.

You can think of variables as names that point to particular values. Let's create a variable called width which will point to the value 24.

width = 24

In short, to create a variable, we use its name followed by the assignment operator =, followed by a value. We can display the value of a variable using the print function.

print(width)

Instructions

Create a variable called height and assign to it the value 8. Optionally, print its value using the print function, as shown in the example above.