practicepython.in
python exercises
171 exercises

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.

8 exercisesdifficulty 2–3~136 min in total
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