-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrock_paper_scissors_game.py
60 lines (46 loc) · 2.01 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
51
52
53
54
55
56
57
58
59
60
import random
print("Rock Paper Scissors - Game")
def game():
random_num_sign = random.randint(1, 3)
if random_num_sign == 1:
random_num_sign = "rock"
elif random_num_sign == 2:
random_num_sign = "paper"
elif random_num_sign == 3:
random_num_sign = "scissors"
while True:
answer = input("Choose your answer (ROCK | PAPER | SCISSORS): ").lower()
if answer == random_num_sign:
print(f"Draw! The computer answered: {random_num_sign.upper()}")
break
if answer == "rock" and random_num_sign == "paper":
print(f"You are lose! The computer answered: {random_num_sign.upper()}")
break
elif answer == "rock" and random_num_sign == "scissors":
print(f"You are win! The computer answered: {random_num_sign.upper()}")
break
if answer == "paper" and random_num_sign == "rock":
print(f"You are win! The computer answered {random_num_sign.upper()}")
break
elif answer == "paper" and random_num_sign == "scissors":
print(f"You are lose! The computer answered {random_num_sign.upper()}")
break
if answer == "scissors" and random_num_sign == "rock":
print(f"You are lose! The computer answered {random_num_sign.upper()}")
break
elif answer == "scissors" and random_num_sign == "paper":
print(f"You are win! The computer answered {random_num_sign.upper()}")
break
if answer != "rock" or answer != "paper" or answer != "scissors":
print("Please enter the correct answer (GRAMMAR OR TYPE MISTAKE)!")
break
game()
while True:
revenge = input("Try again? (YES | NO): ")
if revenge.lower() == "yes":
game()
elif revenge.lower() == "no":
print("Game over, good luck!")
break
else:
print("Please enter the correct answer (GRAMMAR OR TYPE MISTAKE)!")