Making it better
The code already works and every test already passes. What is missing is judgement — the difference between a solution that is correct and one you would be happy to hand to someone else. Here the grader reads how you solved it, not only whether you did.
—Exercises
8 exercises
The flag that should be any()
any and all, short-circuiting
~15 min
The string built one piece at a time
str.join, immutable strings
~15 min
The if-chain that should be data
dict as a lookup table, data versus control flow
~15 min
The counter that enumerate already keeps
enumerate with start, manual counters
~15 min
Unwinding the arrow
guard clauses, early return
~20 min
Numbers that do not say what they are
named constants, one definition per rule
~18 min
The three lines that are one line
setdefault, defaultdict
~18 min
The lookup that scans everything
dict as an index, nested loops
~20 min