Created
February 7, 2019 21:55
-
-
Save pdbartsch/612a954de85da74289d9893f5ebd583a 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
def rps(): | |
print('ROCK - PAPER - SCISSORS: \nRock beats scissors \nScissors beats paper \nPaper beats rock\n') | |
while True: | |
yn = input("Want to play? Yes or No: ").lower() | |
if yn[0] == 'y': | |
play() | |
else: | |
print('\nOK. Maybe later.') | |
break | |
def play(): | |
one = input('Player One, choose either rock(R), paper(P), or scissors(S)? ').lower() | |
two = input('Player Two, choose either rock(R), paper(P), or scissors(S)? ').lower() | |
acceptible = ['r','p','s','rock','paper','scissors'] | |
print('\nplayer one: ', one, '\nplayer two: ', two) | |
if one.lower() in acceptible and two.lower() in acceptible: | |
if one[0] == two[0]: | |
print( 'Tie') | |
elif one[0] == 'r': | |
if two[0] == 'p': | |
print('PLAYER TWO WINS!') | |
else: | |
print('PLAYER ONE WINS!') | |
elif one[0] == 'p': | |
if two[0] == 's': | |
print('PLAYER TWO WINS!') | |
else: | |
print('PLAYER ONE WINS!') | |
elif one[0] == 's': | |
if two[0] == 'r': | |
print('PLAYER TWO WINS!') | |
else: | |
print('PLAYER ONE WINS!') | |
else: | |
print("Something went wrong. Be sure to enter either rock, r, paper, p, scissors, or s.\n Try again:\n") | |
rps() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment