-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrock_paper_scissors_game.py
48 lines (41 loc) · 1.21 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
import random
# Program Start: Funny
print("Rock, Scissors and Paper game!")
print("Rules:")
print("1. Rock; 2. Scissors; 3. Paper;")
print("Let's start? (Y / N)")
answer = input()
if answer == 'N':
print("Goodbye!")
exit()
elif answer == 'Y':
# Logic of Game
# win - lose - draw
win = 0
lose = 0
draw = 0
while True:
options = ["rock", "scissors", "paper"]
computer = random.choice(options)
player = input("Enter your choice: ")
if player not in ("rock", "scissors", "paper"):
print("You miss spelled!")
continue
print("Computer's choice:", computer)
if computer == player:
print("Draw!")
draw += 1
elif player == 'exit':
print("Goodbye!")
exit()
else:
if (computer == "rock" and player == "scissors") or (computer == "scissors" and player == "paper") or (computer == "paper" and player == "rock"):
print("Computer is Won!")
lose += 1
else:
print("You won!")
win += 1
print(f'{win} : {lose} : {draw}')
print("-" * 25)
else:
print("Please try again!")