Standalone coding challenges to sharpen your Python skills. Each challenge is a single file with a problem description, function stub, hints, and built-in tests.
- Read the docstring at the top of each challenge file for the problem description and examples.
- Implement the function where it says
pass.
- Run the file with
python <filename>.py -- the built-in tests will tell you if your solution is correct.
- Check the solution in
solutions/ only after you have genuinely attempted the problem.
| Level |
Description |
Prereqs |
| Beginner |
Core Python: variables, strings, lists, loops, conditionals |
Level 0-2 of the curriculum |
| Intermediate |
Decorators, generators, classes, async, file I/O, data structures |
Level 3-6 of the curriculum |
challenges/
README.md -- This file
beginner/ -- 15 beginner challenges
intermediate/ -- 15 intermediate challenges
solutions/
beginner/ -- Beginner solutions with explanations
intermediate/ -- Intermediate solutions with explanations
- Read the entire docstring before writing any code.
- Use the hint only if you are stuck for more than 5 minutes.
- Run the tests frequently as you build up your solution.
- If all tests pass but you are unsure why, trace through your code by hand with the example inputs.
- Compare your passing solution to the provided solution -- there are often multiple valid approaches.
- Beginner challenges: 10-30 minutes each
- Intermediate challenges: 30-60 minutes each