Python Variable Exercises

Let’s check out some exercises that will help you understand Variables in Python better.

Exercise 2-a

Below is a good example of mixing numbers and text inside the print() function

Assign: 3 to variable glass_of_water.

You can simply assign a number to the variable glass_of_water by typing it on the left side of the equal sign and the number on the right side of it.

Number on the right side doesn’t have to be in quotes.

glass_of_water = 3

Exercise 2-b

Let's try to see what happens after assigning a new value to our variable. Note that program gets executed line by line.

Place the variable: glass_of_water inside the print function and observe what happens.

print (glass_of_water)