Week 13: Data structures

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

A dictionary stores values under keys. In Python it is written between curly braces. Each entry has a key, a colon and a value, and entries are separated by commas. This week you write dictionaries, read a value using its key, and practice the symbols this structure depends on. Curly braces, colons and periods show up often, so their reach needs to be steady.

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 ] key held with Shift. Hold Shift with the opposite pinky and press ] with the right pinky.
  • : is the ; key held with Shift. Hold Shift with the opposite pinky and press ; with the right pinky.
  • . is the period key, pressed with the right ring finger.

Here are two lines that create a dictionary and read one value from it:

score = {"ali": 10, "ayse": 12}
print(score["ali"])

The first line has two entries. Each entry has a key, a colon and a value, and the entries are separated by a comma. The second line prints the value stored under "ali", which is 10.

Technique tips

  • Type the opening curly brace and then the closing one right away. Fill in the entries after that.
  • For the curly braces, press Shift with the opposite pinky first, then the bracket key with the right pinky.
  • Check every colon. Each key needs one colon between it and its value.
  • Keep a space after each comma so every entry stands out when you check the line.
  • Keys written as text need quotation marks. Keep the quotes matched as you type each key.

Lessons

  1. Lesson 1 (10 to 15 minutes): Learn. Watch the keyboard demo for the four symbols. Then type score = {"ali": 10, "ayse": 12} slowly.
  2. Lesson 2 (10 to 15 minutes): Practice. Repeat print(score["ali"]). Check that the braces, quotes and colons are in place every time.
  3. Lesson 3 (10 to 15 minutes): Review. Take the 2-minute test built from this week’s dictionaries. Note which symbol caused the most errors and practice it again next session.

This week’s goal

The goal is 22 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 22 wpm. A missing brace or colon breaks the entire structure, 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.

` ~ 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