Python exception handling exercises
Raise, catch and recover from errors with try, except, else and finally, on problems with tests.
Beginner
- 516. Safe DivisionDivision that never crashes the program25 XP4 min
- 547. Numbers From a FormTurn typed answers into numbers, and count the ones that make no sense30 XP5 min
- 569. Pick an Item by NumberA menu choice typed by a person, with every mistake handled35 XP6 min
- 570. Raise a Clear ErrorRefuse impossible ages with an error that says what is wrong35 XP6 min
- 576. Lights Off When You LeaveWhatever goes wrong inside, the lights still go off40 XP7 min
Intermediate
- 578. A Bank Account That Says NoAn account that refuses to go below zero, and says why60 XP10 min
- 587. Your Own Exception ClassA shop error that knows what ran out and how many were wanted60 XP10 min
- 593. Try the Backup ServerWhen the main server is down, ask the next one65 XP12 min
- 607. Settings With Clear ErrorsA settings reader that names the line you need to fix75 XP15 min
- 609. Check the Sign-Up RecordsClean up form entries and explain every rejected one80 XP16 min
Advanced
Other topics
- Python Basics
- Strings
- Lists
- Dictionaries and sets
- Loops
- Functions
- Math
- File handling
- Modules and random
- Sorting and searching
- Two pointers
- Sliding window
- Stacks and queues
- Recursion and backtracking
- Dynamic programming
- Greedy
- Graphs
- Trees
- Bit manipulation
- Classes
- Iterators and generators
- Parsing
- Simulation
- Python idioms
- Regular expressions
- Codes and ciphers
- Working with data
- Grids and matrices
- Geometry
- Games and puzzles
- Heaps
- Data structures
Or see every challenge, with study plans, today's challenge and duels.