-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
50 lines (49 loc) · 1.7 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import random
options = ["R", "P", "S"]
game_on = True
while game_on:
print("Welcome to the Rock-Paper-Scissors game")
user_choice = input("Choose any of R, P or S : \n")
user_choice = user_choice.upper()
computer_choice = random.choice(options)
print("Player : " + user_choice)
print("CPU :" + computer_choice)
if user_choice == computer_choice:
print("It is a tie! Go again")
pass
elif user_choice == "P" and computer_choice == "R":
print("You won! Do you want to play again?")
choice = input("1 for Yes. 2 for No : \n")
if choice == "1":
pass
else:
game_on = False
print("Thank you for playing")
elif user_choice == "R" and computer_choice == "S":
print("You won! Do you want to play again?")
choice = input("1 for Yes. 2 for No : \n")
if choice == "1":
pass
else:
game_on = False
print("Thank you for playing")
elif user_choice == "S" and computer_choice == "P":
print("You won! Do you want to play again?")
choice = input("1 for Yes. 2 for No : \n")
if choice == "1":
pass
else:
game_on = False
print("Thank you for playing")
elif user_choice == "S" and computer_choice == "R":
print("You lost. Start afresh")
pass
elif user_choice == "R" and computer_choice == "P":
print("You lost. Start afresh")
pass
elif user_choice == "P" and computer_choice == "S":
print("You lost. Start afresh")
pass
else:
print("Invalid selection. Try again")
pass