Week 14: Small programs I

Python code typing course. 23 wpm, 94% accuracy.

This week you write your first small program, one that uses several parts together. It creates a list, walks through each item in turn, and prints each one multiplied by two. A list, a loop and a multiplication work side by side in this program. No new symbols are introduced. The real challenge this week is typing the keys you already know in one smooth flow.

What you will learn

This week there are no new symbols. The symbols in the program were introduced in weeks 2, 4, 6, 8, 10 and 11, so you can revisit their key positions there. Here is the short program:

numbers = [3, 8, 5]
for number in numbers:
    print(number * 2)

The first line creates a list. The second line is the loop header and ends with a colon. The third line is indented by four spaces and prints each number multiplied by two. The output is 6, 16 and 10, in that order.

Technique tips

  • Before you move to the next line, check that every line needing a colon or a closing bracket has one.
  • Return your fingers to the home row between lines. In a longer program, a steady rhythm matters more than a fast burst.
  • For the multiplication sign, press Shift with the opposite pinky first, then the 8 key with the right middle finger.
  • In the practice area, Enter keeps the indent for the next line, so you do not need to type it again.
  • Read the whole program once before you start. Seeing the shape of the code makes mistakes easier to catch.

Lessons

  1. Lesson 1 (10 to 15 minutes): Learn. Type the first two lines of the program slowly. Then explain in your own words what the list and the loop header do.
  2. Lesson 2 (10 to 15 minutes): Practice. Type the whole program from start to finish three times. Check the indentation and the symbols each time.
  3. Lesson 3 (10 to 15 minutes): Review. Take the 2-minute test built from a short program of this kind. Note the line where you made a mistake and type it again.

This week’s goal

The goal is 23 wpm with 94% accuracy. The first star comes when you finish the lessons. The second star comes at 94% accuracy, and the third when you also reach 23 wpm. One small error in a program can change the whole output, so accuracy comes first.

This week’s lessons

Do the lessons in order. Each one ends with a test, and your best result is saved.

  1. Lesson 1: Learn

    Keywords

    12 minutes

    Start
  2. Lesson 2: Practice

    Practice

    12 minutes

    Start
  3. Lesson 3: Review and test

    Review and test

    13 minutes

    Start

All weeks