-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathaaa.py
More file actions
32 lines (27 loc) · 698 Bytes
/
aaa.py
File metadata and controls
32 lines (27 loc) · 698 Bytes
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
import random
def uc():
u = input("Enter Rock, Paper, or Scissors: ")
while u not in ["rock", "paper", "scissors"]:
u = input("Invalid choice. Enter Rock, Paper, or Scissors: ")
return u
def cc():
return random.choice(["rock", "paper", "scissors"])
def win(u, c):
if u == c:
return "Tie"
elif (
(u == "rock" and c == "scissors")
or (u == "paper" and c == "rock")
or (u == "scissors" and c == "paper")
):
return "You won"
else:
return "You lost"
def main():
while True:
u = uc()
c = cc()
print(f"The computer chose {c}.")
result = win(u, c)
print(result)
main()