Skip to content

Instantly share code, notes, and snippets.

@rostyq
Created July 27, 2017 18:13
Show Gist options
  • Save rostyq/f2d1fdab4ad4e7095a6ba31496abdba6 to your computer and use it in GitHub Desktop.
Save rostyq/f2d1fdab4ad4e7095a6ba31496abdba6 to your computer and use it in GitHub Desktop.
from pandas import DataFrame
rules = "\n'r' for 'rock;\n'p' for 'paper';\n's' for 'scissors'."
pick = ['r', 'p', 's']
m = DataFrame([[None, True, False], [False, None, True], [True, False, None]],
columns=pick,
index=pick)
print("Rock-Paper-Scissors Game!\n"+rules)
while True:
one = input("Player one: ")
two = input("Player two: ")
if one not in pick or two not in pick:
print("Answers are incorrect! Type 'r', 'p' or 's'."+rules)
continue
if m[one][two] == True:
print("Player One won!")
elif m[one][two] == False:
print("Player Two won!")
else:
print("No sides!")
if input("One more game? ->") == 'y':
continue
else:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment