04: Python: Variables

The Theory:

Use and store data in variables
Python Variables: Use and store data in variables

Computers can store and process loads of data.

Variables are like boxes that store some useful stuff.

Variables store data so that your program can use and process it.

Variables have a name and a value.

Variables store data that can change when the program runs

A variable name describes what the variable is used to store

The variable value is the actual data that is stored in the variable.

In python, you can assign a value to a variable using name = value

You can access the value stored in a variable just by using its name.

You can also use operators to do things like addition, subtraction, multiplication and division:

We’re going to learn how to write python code that will ask the user a question like we did in the input lesson but this time we’ll remember the answer into a variable.

Key point: Use variables to store data that your program needs to process.

Once you’ve got your head around variables, algebra in maths is dead easy: it’s the same idea of using letters instead of numbers.

On the next page you’ll get some code examples that you can try out for yourself.

3 thoughts on “04: Python: Variables

Leave a Reply

Your email address will not be published. Required fields are marked *