Python class exercises
Design Python classes with state and behaviour, and let the tests check them as soon as you submit.
Beginner
Intermediate
- 67. Hit CounterHow many visits did the site get in the last five minutes?65 XP12 min
- 295. A 2D Vector ClassTeach Python to add, scale and measure arrows on a plane70 XP15 min
- 300. Browser HistoryBack, forward, and the pages that vanish when you go somewhere new70 XP14 min
- 338. Money With a CurrencyDollars and euros should never mix by accident85 XP18 min
Advanced
- 131. LRU CacheA small memory that forgets whatever was used longest ago120 XP20 min
- 139. Time-Travel Key-Value StoreA dictionary that remembers what every key held at any moment125 XP25 min
- 152. Text Editor With UndoTyping, deleting, and the luxury of changing your mind135 XP30 min
- 346. Suppress and Count ErrorsLet some errors slide, but keep a tally of every one115 XP22 min
- 350. Event EmitterShout an event and let every listener hear it, in order120 XP25 min
- 365. Frozen RecordA record that refuses to change, and is safe to use as a key130 XP25 min
- 380. A Matrix ClassGrids of numbers that add, multiply and raise to huge powers140 XP30 min
- 422. Live LeaderboardA game's top table, updating live as thousands of scores pour in160 XP35 min
Expert
- 176. API Rate LimiterLet the polite clients in and slow down the greedy ones210 XP50 min
- 440. Text Editor With a CursorA cursor in a two-million-character file, and every keystroke must feel instant210 XP40 min
- 456. LFU CacheForget the least popular item first, and the stalest one on a tie230 XP50 min
- 489. Nested TransactionsUndo inside undo inside undo: a store that can take it all back260 XP55 min
- 491. Limit Order BookBuyers and sellers meet in the middle: best price first, then first come270 XP60 min
Other topics
- Python Basics
- Strings
- Lists
- Dictionaries and sets
- Loops
- Functions
- Math
- Sorting and searching
- Two pointers
- Sliding window
- Stacks and queues
- Recursion and backtracking
- Dynamic programming
- Greedy
- Graphs
- Trees
- Bit manipulation
- 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.