fudjfmgfhfg

Untitled

Jun 14th, 2015
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. #Rock-Paper-Scissors
  2. from random import randrange
  3.  
  4. def comp_play():
  5.     val = randrange(1,3)
  6.     if val == 1:
  7.         comp = 'R'
  8.     if val == 2:
  9.         comp = 'P'
  10.     if val == 3:
  11.         comp = 'S'
  12.     return comp
  13.  
  14. def game_winner(comp, user):
  15.     winner = 'No one'
  16.     if comp == user:
  17.         winner = 'Tie'
  18.     elif (comp == 'R' and user == 'S') or (comp == 'S' and user == 'P') or (comp == 'P' and user == 'R'):
  19.         winner = 'Computer'
  20.     elif (comp == 'S' and user == 'R') or (comp == 'P' and user == 'S') or (comp == 'R' and user == 'P'):
  21.         winner = 'You'
  22.     return winner
  23.  
  24. print("Ready to play some Rock-Paper-Scissors with Jay?\n-----------------------------------------")
  25.  
  26. user=input("Choose Rock, Paper, or Scissors (Type R, P, or S): \n")
Advertisement
Add Comment
Please, Sign In to add comment