Lesson 1: Getting Started
Lesson 2: Introduction
Lesson 3: Math
Lesson 4: Strings
Lesson 5: Variables
Save A Value
Assign A New Value
Rules
Math Operations
String Operations
Indexes
Assignments Or Comparisons?
Lesson 6: Errors
Lesson 7: Booleans
Lesson 8: Lists
Lesson 9: Logic
Lesson 10: Loops
Lesson 11: Functions
Lesson 12: Input
Lesson 13: Modules
Lesson 14: Games
Lesson 15: Minecraft
Lesson 16: Wrapping Up

Now let's look at another way of working with data in Python - something called a **variable**.

Suppose you use a math expression to calculate a value. We've done this already. It's pretty simple, right?

Let's try this example. Type 6 times 6 and hit Enter.

>>> 6 * 6 36

The value you get back should be 36.

But what if you want to use that value again?

You could type 6 times 6 again, but if you were writing a program you might have to type that a lot.

Luckily Python gives us an easier way to do it. You can give your value a name, then you can use that name over and over again.

Take a look at our next example. Here we're using the name 'puppies' then saying that puppies is equal to 6 times 6.

Go ahead and type the second example exactly as it's written here and hit Enter:

>>> puppies = 6 * 6

We're *assigning* the value of 6 times 6 to the variable `puppies`

.

You shouldn't get any answer back - we haven't asked for one yet. But type the word puppies again and hit Enter. Do you see your value this time?

>>> puppies 36

Go ahead and type and enter the word puppies a few times. You should always get the same answer back.

>>> puppies 36 >>> puppies 36 >>> puppies 36

Notice that in our example the word puppies does not have any quotes around it.

If it had quotes around it, Python would treat it like a string.

Without quotes, Python knows that it's a variable.

>>> 6 * 6 36

>>> puppies = 6 * 6 >>> puppies 36

>>> puppies 36 >>> puppies 36 >>> puppies 36