Skip to content
KeySlice

Python typing practice

Python typing practice means drilling the characters Python actually leans on: the colon that closes every block header, four-space indentation typed by hand, the underscore in snake_case names, == against =, f-string braces, and the -> of a return annotation. Almost all of them are shifted keys on the right hand.

Drill Python typing practice

0 wpm ·

▲ 0 in a row

Just start typing. Errors are marked and cannot be backspaced — accuracy first.

Why a Python drill is not a prose drill

English text is overwhelmingly lower-case letters on the home and top rows, which is why an ordinary typing test flatters you. Python is not like that. Take a line as unremarkable as def load_users(raw: str) -> list: and count what the hands actually did: a colon, two underscores, a pair of parentheses, a hyphen and a greater-than reached with Shift, and a second colon to finish. Nine of those thirty-odd keystrokes are punctuation, and seven of the nine belong to the right hand.

A developer who types 70 words per minute on prose commonly drops under 30 on a block of real source, and the drop is not spread evenly across the line. It concentrates on a handful of characters, each of which costs a hesitation, a glance down, or a retyped token. Those characters are the ones worth practising, and no quantity of typing paragraphs will reach them.

The colon ends every block, and it is a shifted key

On a US layout the colon is Shift plus the semicolon key. Your right little finger places it from its own home key while your left little finger holds Shift, so the two weakest fingers on the keyboard are committed at the same instant. Every def, class, if, elif, else, for, while, try, except and with ends this way. In a hundred-line module you will type it thirty or forty times.

The failure mode is not that people cannot press it. It is that the right hand lifts off home to go and find it, so the next line begins from a hand sitting a centimetre out of position and the errors surface two or three characters after the colon rather than on it. If your accuracy dips right at the start of an indented body, that is what is happening.

Indentation is a keystroke, not a formatting rule

Python is the mainstream language where whitespace is syntax, and it is the one language where your editor has quietly been typing part of the program for you. Auto-indent means a lot of Python developers have never built the motor pattern for a four-space level, let alone the eight or twelve spaces a nested loop inside a method needs.

That is fine until you are somewhere the editor is not: a Python prompt, a YAML block holding a script, a chat message, a comment on a pull request, a notebook field that does not indent for you. The snippets here carry their real indentation as ordinary space characters, never tabs, so the thumb types it like everything else.

snake_case puts the underscore under your weakest finger

The underscore is Shift plus hyphen: the right little finger reaching up and out to the far corner of the alphanumeric block while the left little finger holds Shift. It is the longest reach that finger makes, and PEP 8 makes it the naming convention for every function, variable, method and module in the language.

Dunder names stack the problem. __init__ carries four underscores inside one nine-character token. The line if __name__ == "__main__": packs eight underscores, two shifted quotes, a doubled equals and a colon into twenty-six characters, which makes it the densest symbol run in everyday Python and the reason it is in the drill set. Type it slowly the first few times and watch whether your right hand returns home between the underscores or simply hovers out there.

Equals, doubled equals, and the walrus

= is an unshifted top-row reach for the right little finger. == is the same key struck twice in quick succession, which sounds trivial and is the most common symbol typo in the language, because the second press either fails to register or arrives so fast that it lands as one. A dropped press turns a comparison into an assignment: inside an if that is a syntax error you find immediately, and inside a call it is a silent change of meaning.

Python 3.8 added :=, which puts the shifted colon and the equals on the same little finger back to back. It is rare enough that most people have never typed it fluently and common enough in comprehensions to be worth ten seconds of deliberate practice.

f-strings ask for a quote and a brace in the same breath

Write f"{total}" and count the shift transitions: a plain f, Shift for the quote, Shift again for the opening brace, five ordinary letters, then Shift for the closing brace and Shift once more for the closing quote. Four shifted presses wrapped around one unshifted word, with the shift going on and off between them.

That flicker is the pattern worth drilling, because it is where the hand most often commits to Shift a fraction early and produces a brace where a letter belonged, or a fraction late and drops a plain bracket into a string. The braces themselves are Shift plus the square bracket keys, which is the same up-and-out little finger reach as the underscore, arriving twice per interpolation.

The arrow, and where the work actually lands

Type annotations put -> in every signature that declares a return type: an unshifted hyphen followed immediately by a shifted period. The two characters sit on opposite hands in opposite shift states, and the pair never occurs in English, so there is no existing habit to borrow from.

Add it up and Python distributes the work strikingly unevenly. The colon, the underscore, the quotes, the parentheses, the brackets, the braces, the hyphen and the equals are all reached by the right hand, most of them by its little finger, while the left hand spends much of its time doing nothing except holding Shift. That is the honest reason a language with a reputation for readability is slow to type, and it is what these drills are aimed at.

How to practise this

Ten to fifteen minutes is plenty, and accuracy is the number to watch rather than speed. Type each snippet exactly as written, indentation included, and do not expect to backspace past a mistake here for the same reason you would not in a lesson: the correction is the repetition that matters. If one character keeps breaking the line, slow the whole snippet down until it stops, rather than speeding everything else up to compensate.

If you have not learned touch typing properly yet, do that first. The method is in the step-by-step guide to learning touch typing and it takes a few weeks. If you write more than one language, the other two tracks are C++ typing practice, where braces and semicolons dominate, and HTML typing practice, which is mostly angle brackets and quoted attributes.

Frequently asked questions

Does typing practice actually make you a faster Python programmer?

Not in the way people usually mean. Writing new code is limited by thinking, not by typing, so nobody ships a feature faster because their hands got quicker. What typing practice removes is friction on the mechanical parts of the day: renaming things across a file, retyping a config block, fixing an indentation level, working in a terminal or a notebook cell where autocomplete is thin. It also cuts the class of bug that starts life as a typo inside a string literal or a keyword argument.

Which Python symbols are hardest to type accurately?

The underscore, by a distance. It is Shift plus the hyphen key, which puts the weakest finger on your right hand at the far top-right corner of the board while your left hand holds Shift, and PEP 8 puts it in nearly every function and variable name you write. After that comes the colon, because the same right little finger has to place it at the end of a line where the hand is often already drifting, and then the f-string brace pair, which asks for four shifted presses around one plain word.

Should I turn off autocomplete in my editor to practise?

No. Autocomplete is a genuine tool and crippling your real editor to train is a bad trade. Practise here instead, where the keystrokes are the point, and leave your working setup alone. The gap this closes is the one that appears when you are outside your editor anyway: a REPL, a Dockerfile, a CI config, a review comment, a machine that is not yours.

Do I need to learn touch typing before drilling Python?

Yes, and this is the one piece of advice worth being rigid about. Symbol drills on top of an unreliable letter map make both harder, because you cannot tell whether a mistake came from the symbol or from the hand having drifted off home position. Get the alphabet automatic first, then come back. The order to learn the keys in is set out in the touch typing guide.

Do these drills use tabs or spaces?

Spaces, four per level, and never tabs. That is partly PEP 8 and partly practical: a tab is a single keystroke your fingers learn nothing from, while four spaces are four real presses in the rhythm Python demands whenever an editor is not indenting for you. Every snippet here is space-indented for exactly that reason.

Will Python practice help with other languages?

Partly. The colon, the underscore and the parenthesis work transfer to almost everything, and the habit of keeping the hand anchored while the little finger reaches is universal. What does not transfer is the shape of the language: a Python drill will never ask you for a brace-delimited block or a semicolon at the end of a line, which is most of what makes C++ slow to type. Practise the language you actually write.