Skip to content

Instantly share code, notes, and snippets.

@swalkinshaw
Last active December 14, 2023 20:53
Show Gist options
  • Save swalkinshaw/7a97b5e76549713ee00c7be89be78731 to your computer and use it in GitHub Desktop.
Save swalkinshaw/7a97b5e76549713ee00c7be89be78731 to your computer and use it in GitHub Desktop.
Secret Santa

Holiday Gift Exchange Problem

Description

A Holiday gift exchange is where a group of people are randomly assigned one other person in the group to buy a gift for. This person can be anyone else in the group except for themselves. Everyone should both give and receive a gift.

Design a program that reads a provided CSV file, performs the matching, and then prints out the matches. Assume that you may email the match to the person later, but focus on printing first.

The format of the CSV is name,email on each row.

Don't actually send email for this example. Assume the system or framework has a mail delivery system available.

We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 2 columns, instead of 3 in line 1.
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 2 columns, instead of 3 in line 1.
Ali,[email protected]
Pat,[email protected],Ali
Chris,[email protected],Shawn,Ali,Pat
Shawn,[email protected],Chris,Ali
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 2 columns, instead of 3 in line 1.
Ali,[email protected]
Pat,[email protected],Ali
Chris,[email protected],Pat,Shawn,Tyler
Shawn,[email protected],Chris,Ali
Tyler,[email protected],Chris,Pat,Shawn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment