forked from the-tech-academy/free-classes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RockPaperScissors_TTA.py
47 lines (35 loc) · 1.27 KB
/
RockPaperScissors_TTA.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
#Rock, paper and scissors game in Python
from random import randint
choices = ["rock", "paper", "scissors"]
playGame = True
while playGame == True:
computer = choices[randint(0,2)]
player = input("Choose rock, paper, or scissors?: ").lower()
if computer == player:
print("Tie!")
elif player == "rock":
if computer == "scissors":
print("You win! Rock smashes scissors.")
else:
print("You lose. Paper covers rock.")
elif player == "paper":
if computer == "rock":
print("You win! Paper covers rock.")
else:
print("You lose. Scissors cut paper.")
elif player == "scissors":
if computer == "paper":
print("You win! Scissors cut paper.")
else:
print("You lose. Rock smashes scissors.")
else:
print("Not a valid play. Check your spelling and try again.")
continue
keepPlaying = input("Play again? ").lower()
if keepPlaying == "no":
playGame = False
print("Thanks for playing!")
elif keepPlaying == "yes":
playGame = True
else:
print("Not a valid play. Please type 'yes' or 'no'.")