Overview

Variables are a core part of programming and misconceptions about them are a frequent source of bugs for new (and experienced!) programmers. While you’ve probably heard the word before, what it means in programming might be subtly different than you expect from other contexts.

Basic Learning Objectives

Before class, you should be able to:

  • Define the term variable in a programming context
  • Make a new variable using an assignment statement
  • Use an existing variable
  • Change an existing variable
  • Choose legal and descriptive names for your variables

Advanced Learning Objectives

After class, you should be able to:

  • Explain what it means to evaluate a variable and identify when evaluation occurs
  • Explain what happens when one variable is assigned the value of another variable
  • Predict what value a variable will have at the end of a program, especially when the program uses and changes multiple variables
  • Draw reference diagrams to show what is happening with a variable in a program, especially when the variable is changed
  • Use several variables in a program to solve a problem
  • Explain the similarities and differences between variables in programming, math, and other contexts

Readings

You should read/watch each of the following and complete the checks:

Checks

In addition to the embedded questions in the readings, you should complete the CodeCheck through Moodle.

Written Answers

Finally, submit answers to the following questions on Moodle:

  • What does the term variable mean in a programming context?
  • What is the syntax for making a new variable in Python?