Practice Arena

Python Coding Challenges

Write real Python in the browser. Instant feedback. From beginner to expert.

925 challenges 556 easy 323 medium 46 hard
Error Handling & Exceptions easy

Safe Integer from String

Implement safe_int that converts a string to an integer, returning a default value on any failure, with support for an optional base.

exceptions parsing default-value
+10 pts 15m
Error Handling & Exceptions easy

Safe int parser

Implement safe_parse_int that converts a string to an int, returning a default value on failure.

exceptions parsing validation
+10 pts 10m
Error Handling & Exceptions easy

Divide with zero check

Write a function that safely divides two numbers, catching division by zero.

exceptions division error-handling
+8 pts 10m
Error Handling & Exceptions easy

Key error handler

Implement a safe dictionary access function that returns a default value on missing keys.

exceptions dict fallback
+8 pts 10m
Error Handling & Exceptions easy

Parse JSON safely

Implement a robust JSON string parser that returns a fallback on invalid input.

json exceptions try-except
+8 pts 10m
Error Handling & Exceptions easy

Exit handler registration

Write a function that registers a callback to run at interpreter exit and returns True on success.

atexit exceptions cleanup
+8 pts 12m
Error Handling & Exceptions easy

Parse Error Recovery

Parse a whitespace-separated string into a list of valid integers, skipping invalid tokens.

parsing exceptions error-handling
+10 pts 15m
Error Handling & Exceptions medium

Resource Cleanup Manager

Implement a context manager that tracks and releases resources reliably, and can report cleanup actions.

context-managers exceptions cleanup
+20 pts 20m
Error Handling & Exceptions medium

Suppress Specific Exceptions

Implement a custom context manager that suppresses specified exception types within its block.

context-manager exceptions suppress
+20 pts 20m

Showing 1–9 of 9 challenges

Guide: free Python coding challenges

Practice Python by solving problems

PythonSkillset challenges are hands-on coding exercises from beginner to advanced. Open a challenge, read the problem, write Python in the split-pane editor, and run tests with Pyodide — no install required.

How to use the arena

  1. Pick a category — basics, algorithms, strings, and more
  2. Open a challenge, read the statement, and edit the starter code
  3. Run tests, fix failures, then try a related quiz or tutorial lesson

Challenges vs tutorials and quizzes

Challenges test what you can build under constraints. For guided teaching, use our Python tutorials. For quick checks, try quizzes or copy snippets from code samples.