Paul's Python CoursePPC

Project 3 of 20, for Caitlin

Lost Property Matcher

Match what was left behind after the Studio's game nights against what people have asked about, counting every umbrella once.

About 50 minutes, in 11 steps.

Sign up free to open itLog in

Act 2 needs a free account, so your work is saved as you go. Act 1 is open to everyone.

The brief

  • CaitlinI've ended up in charge of the Studio's lost property box, and Friday game nights keep it full.
  • CaitlinEvery umbrella's written down twice, some of them three times, and there's one scarf that's on there eleven times.
  • CaitlinI just want each thing listed once, and I'd like to know which ones people have asked about.
  • PaulSounds like a job for sets, because they don't hold with duplicates either.

found lists everything handed in, repeats and all. reported lists what people have asked about.

Write report(found, reported). It prints four lines:

  • how many different items were handed in
  • the items handed in that someone has asked about
  • the items handed in that nobody has asked about
  • the items asked about that haven't turned up

Items go in alphabetical order, separated by , . A line with no items says none.

What it prints
Handed in: 4 different items
Matched: black umbrella, red scarf
Nobody has asked about: blue headphones, dice bag
Still missing: spare controller

What you learn

What's in it

  1. One of each
  2. How many different things
  3. Comparing two sets
  4. In both boxes
  5. How fast is in
  6. The raffle tickets
  7. How Paul would do it
  8. Fix Aaesha's version
  9. Make the lost property matcher
  10. Ship it