Week 8: Conditions
Python code typing course. 17 wpm, 92% accuracy.
A program can behave differently depending on whether a condition is true. In Python you make that decision with the word if. After the condition comes a colon, and the lines below it are indented. This week you practice that pattern. You need the comparison signs and the colon typed correctly, and the indentation has to stay consistent from line to line.
What you will learn
On the US English layout, the four symbols are typed like this:
:is the;key held with Shift. Hold Shift with the opposite pinky and press;with the right pinky.<is the comma key held with Shift. Hold Shift with the opposite pinky and press the comma key with the right middle finger.>is the period key held with Shift. Hold Shift with the opposite pinky and press the period key with the right ring finger.=is the=key, pressed with the right pinky.
Here is a short condition with its indented block:
if number > 10:
print("yes")
The colon at the end of the first line is required. The second line is indented by four spaces. In the practice area, Enter after a colon indents the next line for you.
Technique tips
- For the colon, press Shift with the opposite pinky first, then the
;key with the right pinky. - Check the colon at the end of each condition before you move to the next line. A missing colon stops the block from running.
- The
<and>symbols use the comma and period keys with Shift. Keep the right middle and right ring fingers close to their keys. - Before typing an indented line, confirm that the line above ends with a colon.
Lessons
- Lesson 1 (10 to 15 minutes): Learn. Watch the keyboard demo for the colon and the comparison signs. Then type
if number > 10:slowly. - Lesson 2 (10 to 15 minutes): Practice. Repeat the
print("yes")line under the condition, with its indentation. Check that the colon and the indent are in place each time. - Lesson 3 (10 to 15 minutes): Review. Take the 2-minute test built from this week’s conditions. Note the symbol you missed most and practice it again next session.
This week’s goal
The goal is 17 wpm with 92% accuracy. The first star comes when you finish the lessons. The second star comes at 92% accuracy, and the third when you also reach 17 wpm. A missing colon breaks the whole block, so accuracy is the priority.
Symbols this week
The colored keys are the ones you learn this week. The color shows which finger presses the key.
This week’s lessons
Do the lessons in order. Each one ends with a test, and your best result is saved.