Editor

Python dictionary and set exercises

Counting, grouping and looking things up with dictionaries and sets, in problems checked by tests in your browser.

Beginner

  1. 28. Count the VotesThe polls have closed: time to count every ballot30 XP5 min
  2. 42. First One of a KindIn a crowd of repeats, who showed up only once?40 XP8 min
  3. 252. Merge Two Contact ListsTwo address books, one tidy list with nobody in it twice40 XP8 min
  4. 502. Cafe Order TotalRead the menu and add up what the table ordered25 XP4 min
  5. 529. Who Is Absent?Compare the class list with who showed up today25 XP4 min
  6. 536. Combine Two Shopping CartsTwo people shop online: put everything into one cart30 XP5 min
  7. 537. Count Each LetterWhich letters does a sentence use, and how often?30 XP5 min
  8. 548. Phone Book LookupFind a friend's number, however their name was typed30 XP5 min
  9. 557. Top ScorerThe game is over: whose name goes at the top of the board?30 XP4 min
  10. 559. Word-for-Word TranslatorTurn an ordinary sentence into pirate talk30 XP5 min
  11. 561. Best Score per PlayerEach player's personal best from a pile of results35 XP5 min
  12. 562. Can We Fill the Order?A shop that refuses to sell its last apples35 XP5 min

Intermediate

  1. 64. Repeats Close TogetherHas anything come back too soon?60 XP10 min
  2. 77. Two SumSomewhere in the list, two numbers make the target65 XP10 min
  3. 91. Group the AnagramsSame letters, different words: sort them into families75 XP12 min
  4. 102. The K Most FrequentWhich values keep turning up more than any others?80 XP14 min
  5. 592. Top Scorer of the SeasonThe league table forgets every game but the last65 XP9 min
  6. 602. Read a Nested SettingDig through settings inside settings with one dotted path70 XP10 min
  7. 623. GatecrashersA long guest list, a longer queue at the gate: who was never invited?60 XP10 min
  8. 625. Songs That End on the MinuteTwo songs back to back that finish exactly on the minute75 XP15 min
  9. 631. Library Lending DeskBooks go out, books come back, and someone always brings one back late170 XP60 min

Advanced

  1. 117. Pairs That Differ by KHow many different pairs sit exactly k apart?110 XP18 min
  2. 136. Longest Consecutive RunHidden in the jumble: the longest unbroken count125 XP20 min
  3. 151. Subarrays That Sum to KHow many stretches of the list add up to exactly k?135 XP22 min
  4. 162. Smallest Rectangle From PointsFour of these dots make a box. How small can it be?150 XP28 min

Expert

  1. 171. Zero Sum Across Four ListsOne number from each of four lists: how often do they cancel out?190 XP25 min
  2. 184. Lamps on a Huge GridLamps light rows, columns and diagonals. Is this square in the dark?230 XP40 min
  3. 188. Most Points on One LineLay a ruler across the dots: how many can it touch at once?240 XP45 min

Other topics

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