Created
July 27, 2017 18:13
-
-
Save rostyq/f2d1fdab4ad4e7095a6ba31496abdba6 to your computer and use it in GitHub Desktop.
Exercise on www.practicepython.org
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
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