Skip to content

Instantly share code, notes, and snippets.

@markdcummings
Created November 13, 2016 16:22
Show Gist options
  • Save markdcummings/22a171ef19072d9b156a0782c35cf453 to your computer and use it in GitHub Desktop.
Save markdcummings/22a171ef19072d9b156a0782c35cf453 to your computer and use it in GitHub Desktop.
import random
players = ['Garry', 'Joanna', 'Sara', 'Mark', 'Phil', 'Tom']
houses = ['Stark', 'Greyjoy', 'Dorne', 'Tyrell', 'Lannister', 'Baratheon']
drawing = range(0, len(houses))
random.shuffle(drawing)
chosen_families = {p: houses[drawing[i]] for (i, p) in enumerate(players)}
for player, house in chosen_families.items():
print('%(player)s is assigned house %(house)s' %
{'player': player, 'house': house})
@markdcummings
Copy link
Author

$ python assign_houses.py

Sara is assigned house Lannister
Phil is assigned house Dorne
Mark is assigned house Baratheon
Garry is assigned house Tyrell
Joanna is assigned house Greyjoy
Tom is assigned house Stark

@markdcummings
Copy link
Author

Actually this is too complicated, here's a better version:

https://gist.github.com/codeweevil/1b1c7408a76b896492b5fcb432dcb8e8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment