Week 5: Comparison and logic

Python code typing course. 14 wpm, 91% accuracy.

Programs often compare one value with another. Is a number bigger? Are two values equal? Comparison operators answer these questions. This week you learn <, >, !, =, & and |, one at a time.

What you will learn

On the US English layout, the six symbols are typed like this:

  • < is the comma key with Shift: opposite pinky on Shift, right middle finger on the key.
  • > is the period key with Shift: opposite pinky on Shift, right ring finger on the key.
  • ! is the 1 key with Shift: opposite pinky on Shift, left pinky on the key.
  • = is the = key, pressed with the right pinky.
  • & is the 7 key with Shift: opposite pinky on Shift, right index finger on the key.
  • | is the backslash key with Shift: opposite pinky on Shift, right pinky on the key.

Here are two lines that use these symbols:

print(3 < 5)
print(2 != 3)

The first line prints True, because 3 is less than 5. The != operator is written with two symbols: first !, then =. Try to type them as one smooth movement.

Technique tips

  • Press Shift with the opposite pinky before the symbol key, and release both after the symbol appears.
  • The ! and = keys sit close together. Treat them as one short movement so the rhythm does not break.
  • Read the two sides of a comparison together, such as 3 < 5, as one small expression.
  • The | symbol uses the backslash key with Shift. Keep your right pinky steady and do not lift the whole hand.

Lessons

  1. Lesson 1 (10 to 15 minutes): Learn. Watch the keyboard demo for all six symbols. Then type print(3 < 5) slowly.
  2. Lesson 2 (10 to 15 minutes): Practice. Repeat lines such as print(2 != 3), print(5 > 1) and print(4 == 4). Check that each symbol is the one you meant.
  3. Lesson 3 (10 to 15 minutes): Review. Take the 2-minute test built from this week’s comparison symbols. Note the symbol you confuse most and give it extra practice in the next session.

This week’s goal

The goal is 14 wpm with 91% accuracy. The first star comes when you finish the lessons. The second star comes at 91% accuracy, and the third when you also reach 14 wpm. A single wrong symbol changes the meaning of a comparison, so accuracy comes first.

Symbols this week

The colored keys are the ones you learn this week. The color shows which finger presses the key.

` ~ 1 ! 2 @ 3 # 4 $ 5 % 6 ^ 7 & 8 * 9 ( 0 ) - _ = + Backspace Tab Q W E R T Y U I O P [ { ] } \ | Caps A S D F G H J K L ; : ' " Enter Shift Z X C V B N M , < . > / ? Shift Ctrl Win Alt Alt Gr Win Menu Ctrl

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

    New symbols: < > ! = & |

    12 minutes

    Start
  2. Lesson 2: Practice

    Practice

    12 minutes

    Start
  3. Lesson 3: Review and test

    Review and test

    12 minutes

    Start

All weeks