-
Notifications
You must be signed in to change notification settings - Fork 4
/
Rock_Paper_Scissors_Game.py
50 lines (40 loc) · 1.5 KB
/
Rock_Paper_Scissors_Game.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
user_points=0
comp_points=0
chances=["rock","paper","scissors"]
print("\nROCK PAPER SCISSORS GAME")
print("---------------------------")
while True:
user_choice=input("Enter your choice rock/paper/scissors or q to quit: ").lower()
if user_choice=='q':
break
if user_choice in chances:
comp_choice=random.choice(chances)
print("User choice :",user_choice)
print("Computer choice :",comp_choice)
if user_choice=='rock' and comp_choice=='scissors':
print("#------------------->USER WINS!\n")
user_points+=1
elif user_choice=='scissors' and comp_choice=='paper':
print("#------------------->USER WINS!\n")
user_points+=1
elif user_choice=='paper' and comp_choice=='rock':
print("#------------------->USER WINS!\n")
user_points+=1
elif user_choice==comp_choice:
print("#------------------->TIE! TRY AGAIN\n")
else:
print("#------------------->COMPUTER WINS!\n")
comp_points+=1
else:
print("\tEnter only rock/paper/scissors!")
print("---------------------------")
print("\nUser Points :",user_points)
print("Computer Points :",comp_points)
if user_points>comp_points:
print("\n\tCONGRATULATIONS YOU WON! :)")
elif user_points==comp_points:
print("\n\tIT'S A TIE! TRY AGAIN")
else:
print("\n\tSORRY YOU LOOSE :(")
print()