Editor

Python class exercises

Design Python classes with state and behaviour, and let the tests check them as soon as you submit.

Beginner

  1. 49. Bank Account With OverdraftKeep the money right, even when the balance dips below zero45 XP10 min
  2. 236. A Stack ClassA pile of plates where only the top one can be touched35 XP8 min

Intermediate

  1. 67. Hit CounterHow many visits did the site get in the last five minutes?65 XP12 min
  2. 295. A 2D Vector ClassTeach Python to add, scale and measure arrows on a plane70 XP15 min
  3. 300. Browser HistoryBack, forward, and the pages that vanish when you go somewhere new70 XP14 min
  4. 338. Money With a CurrencyDollars and euros should never mix by accident85 XP18 min

Advanced

  1. 131. LRU CacheA small memory that forgets whatever was used longest ago120 XP20 min
  2. 139. Time-Travel Key-Value StoreA dictionary that remembers what every key held at any moment125 XP25 min
  3. 152. Text Editor With UndoTyping, deleting, and the luxury of changing your mind135 XP30 min
  4. 346. Suppress and Count ErrorsLet some errors slide, but keep a tally of every one115 XP22 min
  5. 350. Event EmitterShout an event and let every listener hear it, in order120 XP25 min
  6. 365. Frozen RecordA record that refuses to change, and is safe to use as a key130 XP25 min
  7. 380. A Matrix ClassGrids of numbers that add, multiply and raise to huge powers140 XP30 min
  8. 422. Live LeaderboardA game's top table, updating live as thousands of scores pour in160 XP35 min

Expert

  1. 176. API Rate LimiterLet the polite clients in and slow down the greedy ones210 XP50 min
  2. 440. Text Editor With a CursorA cursor in a two-million-character file, and every keystroke must feel instant210 XP40 min
  3. 456. LFU CacheForget the least popular item first, and the stalest one on a tie230 XP50 min
  4. 489. Nested TransactionsUndo inside undo inside undo: a store that can take it all back260 XP55 min
  5. 491. Limit Order BookBuyers and sellers meet in the middle: best price first, then first come270 XP60 min

Other topics

Or see every challenge, with study plans, today's challenge and duels.