Python list exercises
Python list problems, from indexing and slicing to comprehensions and in-place changes, each checked by tests in your browser.
Beginner
- 9. Count ElementHow many times does it appear?40 XP4 min
- 11. Sum of ListAdd up a list the long way40 XP4 min
- 13. Find MaximumThe largest value, found by hand45 XP5 min
- 14. Reverse a ListBack to front45 XP5 min
- 26. Flatten One LevelBoxes inside a box: tip them all out onto the table25 XP4 min
- 39. The Missing NumberEvery number from zero upwards is here, except one35 XP5 min
- 205. Running TotalHow does the balance look after each payment?25 XP4 min
- 209. Above AverageWhich days beat the monthly average?30 XP5 min
- 212. Chunk a ListSix eggs to a box: how do the boxes fill up?30 XP5 min
- 243. Second Largest ValueWho takes the silver medal when ties share the gold?35 XP6 min
Intermediate
- 18. Remove DuplicatesEvery item once, order kept60 XP7 min
- 55. Rotate a ListSpin the list around without losing anyone55 XP8 min
- 78. Common to Every ListWhat do all the shopping lists have in common?70 XP14 min
- 97. Rotate the GridTurn a square picture a quarter turn to the right75 XP12 min
- 107. Merge Overlapping IntervalsOverlapping bookings melt into one long block85 XP15 min
- 114. Product of All the OthersEvery number, multiplied by everyone except itself90 XP15 min
- 275. Row of Pascal's TriangleA famous triangle of numbers, one row at a time60 XP10 min
Advanced
- 121. Insert an IntervalA new booking lands in an already busy calendar115 XP20 min
- 122. Many Range UpdatesThousands of edits to a long list, and only the final result matters115 XP18 min
- 153. Balanced Zeros and OnesThe longest stretch where zeros and ones are perfectly even140 XP25 min
- 168. Make the Sum DivisibleCut out the shortest stretch so the total divides evenly165 XP30 min
Expert
Other topics
- Python Basics
- Strings
- 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
- 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.