Skip to main content

Incrementing Ints

In computer programming, you often need to increase a variable by one.

Dependencies

Students need to have these skills before learning this skill:

Goal

When you teach this skill, your goal is to make it so that students can write code that looks like this:

score = 0
score = score + 1

Activities

Here are some activities that you can do in order to teach this skill.

Writing on the board

  1. Write this code on the board:

    score = 0
    print(score)
    score = score + 1
    print(score)
  2. Ask students what they think that code is going to do.

  3. After calling on a few students, reveal the correct answer.

  4. Ask all students to write similar code on their computers. Students can choose a different variable name when copying the code if they want to.

  5. Have students run their code in order to make sure that it works.