-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rock_Paper_Scissors.py
44 lines (33 loc) · 1.08 KB
/
Rock_Paper_Scissors.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
import random
user_wins = 0
computer_wins = 0
options = ["rock","paper","scissors"]
length = 0
while True:
user_input = input("\nType Rock/Paper/Scissors or Q to quit: ").lower()
if user_input == "q":
break
if user_input not in options:
print("Choose wisely,")
continue
random_number = random.randint(0,2)
computer_guess = options[random_number]
print(f"Computer picked: {computer_guess}")
if user_input == "rock" and computer_guess == "scissors":
print("\nYou Won!")
user_wins += 1
elif user_input == "paper" and computer_guess == "rock":
print("\nYou Won!")
user_wins += 1
elif user_input == "scissors" and computer_guess == "paper":
print("\nYou Won!")
user_wins += 1
elif user_input == computer_guess:
print("\nBoth Tie!")
else:
print("\nComputer Won!")
computer_wins += 1
length += 1
print(f"\n\tYou got {user_wins} points out of {length}.")
print(f"\tComputer got {computer_wins} points out of {length}.")
print("\n\tHave a nyc day,Bye...!")