Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Rock-Paper-Scissors
- from random import randrange
- def comp_play():
- val = randrange(1,3)
- if val == 1:
- comp = 'R'
- if val == 2:
- comp = 'P'
- if val == 3:
- comp = 'S'
- return comp
- def game_winner(comp, user):
- winner = 'No one'
- if comp == user:
- winner = 'Tie'
- elif (comp == 'R' and user == 'S') or (comp == 'S' and user == 'P') or (comp == 'P' and user == 'R'):
- winner = 'Computer'
- elif (comp == 'S' and user == 'R') or (comp == 'P' and user == 'S') or (comp == 'R' and user == 'P'):
- winner = 'You'
- return winner
- print("Ready to play some Rock-Paper-Scissors with Jay?\n-----------------------------------------")
- user=input("Choose Rock, Paper, or Scissors (Type R, P, or S): \n")
Advertisement
Add Comment
Please, Sign In to add comment