Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import time
- print("ROCK PAPER SCISSORS")
- print(20*'-')
- rps = ['Rock = R' , 'Paper = P' , 'Scissors = S']
- for u in rps:
- print(u)
- while True :
- try:
- spr = ['R' ,'P' ,'S']
- comp = random.choice(spr)
- user = input("CHOOSE (R/P/S) : ")
- time.sleep(0.5)
- if user not in spr:
- raise ValueError
- elif comp == 'R'and user == 'S':
- print("Computer choose Rock. You Lose!")
- elif comp == 'S'and user == 'R':
- print("Computer choose Scissors. You Win!")
- elif comp == 'P'and user == 'S':
- print("Computer choose Paper. You Win!")
- elif comp == 'S'and user == 'P':
- print("Computer choose Scissors. You Lose!")
- elif comp == 'R'and user == 'P':
- print("Computer choose Rock. You Win!")
- elif comp == user:
- print("Same as computer lol. Its a tie.")
- else:
- print("Computer choose Paper. You Lose!")
- except ValueError:
- print("NOT VALID ANSWER. Please reenter.")
- again = input("Again?? ")
- if again == "y" or again =="yes":
- print()
- continue
- else:
- print("BYE")
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement