Python typing practice

Real Python, indentation and all. Type the leading spaces exactly - in Python they are syntax, not formatting.

0wpm
100% acc
0:00Time
scores = [row["wpm"] for row in sessions if row["accuracy"] > 95] top_ten = sorted(scores, reverse=True)[:10] average = sum(top_ten) / len(top_ten)

Just start typing.Tabrestarts

Left handRight hand

Snippet: Comprehension and slicing (python)

The Python symbol profile

Python is lighter on brackets than most languages but much heavier on two specific characters: the colon, which ends every block header, and the underscore, which appears in almost every identifier written in snake_case.

Both are shifted or awkward. The colon is shift plus semicolon under the right little finger; the underscore is shift plus hyphen, also right little finger. If your right little finger is weak, Python will feel disproportionately slow.

Indentation is real typing

In most languages leading whitespace is cosmetic and the editor handles it. In Python it carries meaning, and it is worth being able to produce it deliberately rather than relying on auto-indent.

Practising with the indentation included also builds the habit of reading structure as you type, which is what stops the misaligned block that only shows up at runtime.

Common questions

Spaces or tabs?

These snippets use four spaces, following the convention in PEP 8. The typing skill transfers either way.

Keep going