-
Notifications
You must be signed in to change notification settings - Fork 18
/
RockPaperScissor
31 lines (31 loc) · 1.05 KB
/
RockPaperScissor
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
import random
print("Hi!",input("What is Your good Name? "))
user = 0; computer = 0
l = ["rock","paper","scissor","q"]
while True:
user_sel = input("Please Select Either of Rock/Paper/Scissor or Q to Quit ").lower()
a = random.randint(0,2)
computer_sel = l[a]
if user_sel == "q":
break
elif user_sel not in l:
print("Invalid Input!!, Try again")
continue
print("Computer Chose:",computer_sel)
if user_sel == "rock" and computer_sel == "scissor":
print("Congrats! You Win")
user+=1
elif user_sel == "paper" and computer_sel == "rock":
print("Congrats! You Win")
user += 1
elif user_sel == "scissor" and computer_sel == "paper":
print("Congrats! You Win")
user += 1
elif user_sel == computer_sel:
print("Ohh! Its a Draw")
else:
print("OOPS! I think you Lost")
computer+=1
print("You Won", user, "times.")
print("Computer Won", computer, "times.")
print("Thanks For Playing, Have a Nice Day :)")