-
Notifications
You must be signed in to change notification settings - Fork 118
Expand file tree
/
Copy pathmain.py
More file actions
64 lines (55 loc) · 1.48 KB
/
main.py
File metadata and controls
64 lines (55 loc) · 1.48 KB
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
61
62
63
64
import random
import time
import os
lose_game = [
"Oops! That didn't go well.",
"Better luck next time!",
"The computer strikes again!",
"You got outplayed!",
"That was embarrassing... for you.",
]
options = ("rock", "paper", "scissors")
wins = 0
losses = 0
ties = 0
tries = 0
running = True
while running:
player = None
computer = random.choice(options)
while player not in options:
player = input("Pick a choice: rock, paper, scissors? ").lower()
time.sleep(0.5)
print("Rock...")
time.sleep(0.5)
print("Paper...")
time.sleep(0.5)
print("Scissors...")
time.sleep(0.5)
print("Shoot!")
time.sleep(0.5)
print(f"computer: {computer}")
print(f"player: {player}")
if player == computer:
print("It's a tie")
ties += 1
elif (player == "rock" and computer == "scissors") or \
(player == "paper" and computer == "rock") or \
(player == "scissors" and computer == "paper"):
print("yayy! you win")
wins += 1
else:
print("Oh no! you lose")
print(random.choice(lose_game))
losses += 1
tries += 1
print("Do you want to play again? (y/n)")
answer = input().lower()
if answer != "y":
running = False
print(f"Final Score: Wins: {wins}, Losses: {losses}, Ties: {ties}, Tries: {tries}")
if wins > losses:
print("You are the winner! Congratulations!")
else:
print(random.choice(lose_game))
print("Thank you for playing!")