Created
November 18, 2016 20:47
-
-
Save dnozay/decd7469820b2950583d627e18f63319 to your computer and use it in GitHub Desktop.
quick tool for making a christmas gifting list.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# e.g. python gift-shuffle.py linda dad adam misty laura damien bryan joelle | |
# dad == gives present to ==> damien | |
# damien == gives present to ==> joelle | |
# joelle == gives present to ==> linda | |
# linda == gives present to ==> adam | |
# adam == gives present to ==> laura | |
# laura == gives present to ==> bryan | |
# bryan == gives present to ==> misty | |
# misty == gives present to ==> dad | |
import sys | |
import random | |
people = sys.argv[1:] | |
if len(people) < 2: | |
raise RuntimeError('not enough people for gift shuffle') | |
random.shuffle(people) | |
for santa, person in zip([people[-1]]+people[:-1], people): | |
print '{0:^15} == gives present to ==> {1:^15}'.format(santa, person) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment