~/devtype

Python Typing Speed Test

Python trades braces for indentation and camelCase for snake_case — which means the underscore and colon do the heavy lifting. These drills train the patterns Python actually uses: comprehensions, decorators, dunder methods, and f-strings.

LV 1
Level 0 / 100 XP
Best 0 WPM
main.js
00 wpm
00%
0s
1
Just start typing or click the code
Esc restart Enter new line, indentation is skipped for you

Why Python Typing Has Its Own Rhythm

snake_case makes the underscore — a Shift-hyphen reach — one of Python's most typed characters, appearing mid-identifier where a stumble breaks your naming flow. Dunder methods like `__init__` double it up in sequence. The colon terminates every block opener (`def`, `if`, `for`, `with`, `class`), making the colon-Enter-indent sequence Python's defining keystroke pattern.

List and dict comprehensions pack brackets, `for`, `in`, and conditionals into one line — `[u.id for u in users if u.active]` is a full workout of bracket-word alternation. F-strings add brace interpolation inside quotes, and decorators start lines with `@`, a top-row reach most typists never drill. Indentation itself is handled for you here: DevType auto-skips leading whitespace so you practice code, not the space bar.

Key Drills for Python:

  • Master the underscore: snake_case means Shift-hyphen mid-word, constantly. Drill it until identifiers flow without a pause.
  • Colon closes the thought: Every block opener ends with a colon. Make `:` then Enter a single motion.
  • Comprehension chunks: Practice `for x in` as a unit inside brackets — it's the backbone of Pythonic one-liners.

Sample Drill: List & Dict Comprehensions

Elegant inline loops in Python using list comprehensions.

py-comprehension · easy
users = [{"id": 1, "role": "admin"}, {"id": 2, "role": "user"}]
admin_ids = [u["id"] for u in users if u["role"] == "admin"]
user_map = {u["id"]: u for u in users}

All 16 Python Drills

Every session picks a random drill from this pool. Use the difficulty filter above to stay on easy warm-ups or jump straight to the hard ones.

  • List & Dict Comprehensions easy

    Elegant inline loops in Python using list comprehensions.

  • F-String Formatting easy

    Format numbers with separators and align columns in f-strings.

  • Pathlib File Paths easy

    Build a config path with pathlib and create its parent folder.

  • Enumerate and Zip easy

    Loop over two lists together with a 1-based rank counter.

  • Count with Counter easy

    Tally HTTP status codes from an access log using Counter.

  • Custom Timing Decorator medium

    Writing decorators with wrap functions to measure performance.

  • Dataclass & Type Hints medium

    Typed dataclasses with defaults and field factories.

  • FastAPI Route medium

    An async FastAPI endpoint with a path param and 404 handling.

  • Pytest Parametrize medium

    Run one test function against several input and output pairs.

  • Group with defaultdict medium

    Group email usernames by domain using a defaultdict of lists.

  • Chunked File Generator medium

    Stream a large file in fixed-size chunks with a generator.

  • Custom Context Manager hard

    A class managing file connection setup and teardown contexts.

  • Bounded Async Fetches hard

    Fetch many URLs concurrently with httpx and a semaphore limit.

  • Pandas Monthly Rollup hard

    Aggregate paid orders into monthly revenue per region in pandas.

  • Structural Protocols hard

    Type a dependency with typing.Protocol instead of inheritance.

  • Argparse CLI Entry hard

    A testable command-line entry point built with argparse.

The Symbols That Slow You Down

The keystrokes below are where Python typing speed is won or lost. Key positions shown for QWERTY — the pattern transfers to any layout, just on different physical keys.

Symbol Used For Keys How to Drill It
_ Underscore Shift+Hyphen snake_case makes this Python's most-typed symbol. The reach is a left-pinky stretch mid-identifier — drill until seamless.
: Block colon Shift+Semicolon Ends every `def`, `if`, `for`, `class`, and `with`. Colon-then-Enter-indent is Python's defining keystroke.
__ Dunder pair Shift+Hyphen twice `__init__`, `__name__`, `__repr__` — doubled underscores bookending identifiers. Four strikes in fixed rhythm.
@ Decorator Shift+2 Starts lines, so it's a fresh-hand reach every time. `@decorator` then Enter should flow without a look.
-> Return arrow - unshifted, then > as Shift+Period In every type-annotated signature: `def f(x: int) -> str:`. Hyphen-Shift-period as one roll.
# Comment Shift+3 Comments and shebangs. Shift-3 mid-flow shouldn't break your typing posture.

Common Python Typing Mistakes

  • ✗ Pausing before the underscore inside long identifiers like `max_connection_pool_size` — drill the full name as one word.
  • ✗ Dropping the colon after a block opener at speed: every `def`, `if`, and `for` needs one before Enter.
  • ✗ Typing `==` guards slowly — the double-equals is unshifted and should be nearly as fast as a letter.

What's a Good Python Typing Speed?

Python code typically types a touch faster than brace-heavy languages thanks to short keywords: 30–45 WPM is a solid working speed, and 50+ WPM with 97% accuracy is excellent. snake_case identifiers and f-strings are where most speed is lost.