Untitled
unknown
plain_text
3 years ago
558 B
17
Indexable
import random
def game():
player = input("Choose Your Play! 'r' for rock, 's' for scissors, 'p' for paper\n")
computer = random.choice(['r', 's', 'p'])
# p > r, r > s, s > p
if player == computer:
return "It\'s a Tie!"
if is_win(player, computer):
return 'You won!'
return 'You Lost!'
def is_win(user, opponent):
if (user == 'p' and opponent == "r") or (user == 's' and opponent == 'p') or (user == 'r' and opponent == 's'):
return True
else:
return False
print(game())
Editor is loading...