Skip to content

Instantly share code, notes, and snippets.

@karina-clio
Last active March 10, 2025 17:38
Show Gist options
  • Save karina-clio/aa96ed9de29867226eaca06125c78f62 to your computer and use it in GitHub Desktop.
Save karina-clio/aa96ed9de29867226eaca06125c78f62 to your computer and use it in GitHub Desktop.
Gift Exchange

Gift Exchange

Given a CSV file of friends who want to be assigned in order to exchange gifts:

  1. Write a script that processes a CSV file (use the example file below)
  2. Randomly assign givers to receivers
  3. Print each person's email followed by the email of the person they're assigned to (see example output below)

Additional requirements:

  • A person cannot give a gift to themselves
  • Ensure everyone gives only one gift, and receives only one gift
  • It should be random - if we run the script multiple times we should get different results.

Example output:

[email protected] -> [email protected]
[email protected] -> [email protected]
[email protected] -> [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment