Variables are one of the most important aspects of learning to program. Throughout this lesson we’ve covered:

  • Assigning & Retrieving Values
  • Performing Calculations Using Expressions
  • Different Variable Types for Data Types (numeric, string & boolean)

Let’s review:

Variables can be used to track values in a program.

Numeric Variables

We explained that values can be assigned to and retrieved from a variable by using the variable name.

points = 0 print(points)


We introduced how expressions can be used to assign calculated values to variables:

high_score = points + 100

Data Types

We explained that your program will have to work with many kinds of data and it is useful to be able to have variables with different types. We introduced some common data types:

  • Numbers
  • Strings
  • Booleans

Well done! You have learned one of the fundamental concepts of programming!


This exercise is for review. We’ve allowed for all sorts of variable commands. Try a variety of ways to solving this puzzle, as well as changing the win message.

In order to win, the door must be unlocked. Beyond that there are several ways to win:
  • Try changing the moveDistance using set or the math operators
  • Try changing the goalPositionX or goalPositionY
Set doorLocked to false Set winMessage to Review Complete Subtract 7 from goalPositionX Move Down

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?