Birthday Paradox Checker

Code image

Step 3 – sort the birthdays

It can be hard to see if you have a match when there's just a list of random numbers.

It's a lot easier if you sort the list in to order first.

Python has a simple way to do this,

  1. Add a line to your program that says  birthdays.sort()

    This should sort the list of birthdays so that it's in order

  2. Run your program to check it works (Run > Run module)
  3. Run your program a few times. Do you get a match about half the time or not?

Remember, you might not get a match at all. You're dealing with totally random numbers.