Week 12: Working with text
Python code typing course. 21 wpm, 93% accuracy.
Text is one of the most common kinds of data in a program. In Python you can join two pieces of text with +, and you can call text methods, which are functions attached to a value with a dot. For example, .upper() turns text into capital letters. This week you use the double quote, the period and the plus sign together. Each one has its own key and finger, so learn their positions one by one.
What you will learn
On the US English layout, the three symbols are typed like this:
"is the'key held with Shift. Hold Shift with the opposite pinky and press the'key with the right pinky..is the period key, pressed with the right ring finger.+is the=key held with Shift. Hold Shift with the opposite pinky and press=with the right pinky.
Here are two lines that store a name and print it in capital letters:
name = 'ali'
print(name.upper())
The first line stores the text ali in a variable. The second line calls .upper() on that text, which prints ALI. The method name and its parentheses must be typed exactly.
Technique tips
- For the double quote, press Shift with the opposite pinky first, then the apostrophe key with the right pinky.
- The period is pressed with the right ring finger. Keep your hand still while you move that finger.
- Type the period and the method name without a space in between, as in
name.upper(). - When you join two texts with
+, check that both sides have matching quotation marks. One missing mark causes an error. - Press Shift before the plus sign and release both after it appears, so the symbol comes out clean.
Lessons
- Lesson 1 (10 to 15 minutes): Learn. Watch the keyboard demo for the three symbols. Then type
name = 'ali'slowly. - Lesson 2 (10 to 15 minutes): Practice. Repeat
print(name.upper()). Check that the period, the parentheses and the quotes are in place each time. - Lesson 3 (10 to 15 minutes): Review. Take the 2-minute test built from this week’s text lines. Note the symbol you missed and practice it again next session.
This week’s goal
The goal is 21 wpm with 93% accuracy. The first star comes when you finish the lessons. The second star comes at 93% accuracy, and the third when you also reach 21 wpm. One wrong quote or period changes the whole result, 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.