-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex045.py
More file actions
36 lines (34 loc) · 891 Bytes
/
ex045.py
File metadata and controls
36 lines (34 loc) · 891 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
32
33
34
35
36
#make a rock paper or scissor game
import random
player = input('Choose rock paper or scissor: ')
choices = ['rock', 'paper', 'scissor']
computer = random.choice(choices)
win = 'You win!'
lose = 'You lose!'
tie = 'It\'s a tie!'
vs = 'player choose: {} VS computer choose: {}!!'.format(player, computer)
if player == computer:
print(vs)
print(tie)
elif player == 'rock':
if computer == 'scissor':
print(vs)
print(win)
elif computer == 'paper':
print(vs)
print(lose)
elif player == 'scissor':
if computer == 'paper':
print(vs)
print(win)
elif computer == 'rock':
print(vs)
print(lose)
elif player == 'paper':
if computer == 'scissor':
print(vs)
print(lose)
elif computer == 'rock':
print(vs)
print(win)
print('End of the game!')