-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrockPaperScissorsGame.py
More file actions
39 lines (25 loc) · 981 Bytes
/
rockPaperScissorsGame.py
File metadata and controls
39 lines (25 loc) · 981 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
33
34
35
36
37
38
39
import random
choices = ("r", "p", "s")
while True:
guess = input("Rock, paper, or scissors? (r/p/s):").lower()
if guess not in choices:
print("invalid choice")
continue
com_guess = random.choice(choices)
print("User guess:", guess)
print("Computer guess:", com_guess)
if com_guess == guess:
print("Draw match")
elif (com_guess == "r" and guess == "p") or ( com_guess == "s" and guess == "r") or (com_guess == "p" and guess == "s"):
print("You win")
elif (com_guess == "p" and guess == "r") or (com_guess == "r" and guess == "s") or (com_guess == "s" and guess == "p"):
print("You lose")
else:
print("Invalid choice!")
statement = input("Continue or Skip(c/s):").lower()
if statement == "c":
continue
elif statement == "s":
break
else:
print("Invalid choice")