Skip to content

Instantly share code, notes, and snippets.

@codeboy101
Created January 10, 2016 04:10
Show Gist options
  • Select an option

  • Save codeboy101/27ee89aa547ac9d792a2 to your computer and use it in GitHub Desktop.

Select an option

Save codeboy101/27ee89aa547ac9d792a2 to your computer and use it in GitHub Desktop.
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