practicepython.in
python exercises
171 exercises

Getting the basics right

Small functions where the whole difficulty is in the details — what an exception actually means, what split() does when you give it no argument, and when a number stops being a count and becomes a measurement.

10 exercisesdifficulty 1–2~122 min in total
Keep a number inside a range min and max, guard clauses ~10 min Initials from a name str.split, join ~10 min Read a yes or no from text truthiness versus meaning, sets for membership ~12 min What percentage is this of that true division, guarding the divisor ~10 min One file, two files f-strings, optional parameters ~10 min Convert without crashing try / except, naming the exception ~10 min File sizes people can read f-string format specs, loops with early return ~15 min 1st, 2nd, 3rd, 11th modulo, special case before general rule ~15 min Round to the nearest step banker’s rounding, floor division tricks ~15 min Capitalise a title properly why str.title() is wrong, word-level rules ~15 min