-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRock, paper, scissors.py
More file actions
executable file
·31 lines (29 loc) · 996 Bytes
/
Rock, paper, scissors.py
File metadata and controls
executable file
·31 lines (29 loc) · 996 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
#!/usr/bin/env python3.8
import random
while True:
print("Make your guess:!", end="")
guess = str(input())
guess = guess.lower()
choices = ['rock', 'paper', 'scissors']
computer_guess = random.choice(choices)
print("you guessed", guess)
print("computer guessed", computer_guess)
if guess in choices:
if guess == computer_guess:
print("it is a tie")
elif guess == 'rock':
if computer_guess == 'scissors':
print("You win!")
elif computer_guess == 'paper':
print("Sorry, you lose!")
elif guess == 'paper':
if computer_guess == 'rock':
print('You win!')
elif computer_guess == 'scissors':
print('Sorry, you lose!')
elif guess == 'scissors':
if computer_guess == 'paper':
print("You win!")
elif computer_guess == 'rock':
print("Sorry you lose")
break