Created
January 10, 2016 04:10
-
-
Save codeboy101/27ee89aa547ac9d792a2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import random | |
| people_list = ['john' , 'sherlock' , 'molly'] ## list of random people | |
| x = random.choice(people_list) ## choosing random people to be eliminated further in the game | |
| y = random.choice(people_list) | |
| for i in range(1,10) : | |
| if i == 5 : ## whoever gets the number 5 has to go | |
| people_list.remove(x) | |
| break | |
| if len(people_list) > 1 : ## if 2 people remain , do the game again | |
| for i in range(1,10) : | |
| if i == 5 : | |
| people_list.remove(y) ##remove the final person | |
| break | |
| for i in people_list : | |
| print(i +" won the game!") ## yay | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment