Week 6: Brackets and braces
Python code typing course. 15 wpm, 91% accuracy.
Python stores groups of values in two common ways. Square brackets [ ] make a list, and curly braces { } make a dictionary. Both appear constantly in code, and every opening symbol needs a matching closing one. This week you practice both kinds. Knowing exactly which key and finger each bracket uses is the fastest way to cut down on mistakes.
What you will learn
On the US English layout, the four brackets are typed like this:
[is the[key, pressed with the right pinky.]is the]key, pressed 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.
Here are two short lines with empty containers:
print([])
print({})
The first line prints an empty list, and the second prints an empty dictionary. In both, the opening and closing symbols sit next to each other, so practice typing the pair as one unit.
Technique tips
- Type the opening and closing symbol first, then fill in the contents. This keeps the pair from getting lost.
- For the curly braces, press Shift with the opposite pinky first, then the
[or]key with the right pinky. - Keep your right pinky steady for the bracket keys. Let the rest of your hand stay on the home row.
- Do not mix them up. Square brackets are for lists, curly braces are for dictionaries.
- Dictionaries also use colons and commas inside the braces. You will meet those symbols again in later weeks.
Lessons
- Lesson 1 (10 to 15 minutes): Learn. Watch the keyboard demo for all four brackets. Then type
print([])slowly. - Lesson 2 (10 to 15 minutes): Practice. Repeat
print({})andprint([]). Check that each opening symbol has its matching closing one. - Lesson 3 (10 to 15 minutes): Review. Take the 2-minute test built from this week’s brackets. Note which bracket you missed most and give it extra attention next time.
This week’s goal
The goal is 15 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 15 wpm. A single unmatched bracket breaks the whole line, so accuracy comes before speed.
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.