-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrock_paper_scissors.py
51 lines (36 loc) · 1.19 KB
/
rock_paper_scissors.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
49
50
51
#!/usr/bin/env python3
import random
print("Select option: \n[ 1 ] rock \n[ 2 ] paper \n[ 3 ] scissors\n")
option = input("Your option: ")
lista = ["rock", "paper", "scissors"]
pc = random.choice(lista)
def obracun():
if int(option) == 1 and pc == lista[0]:
print("\nPc option is: ", pc)
print('draw')
if int(option) == 1 and pc == lista[1]:
print("\nPc option is: ", pc)
print('u lost')
if int(option) == 1 and pc == lista[2]:
print("\nPc option is: ", pc)
print('u win')
if int(option) == 2 and pc == lista[0]:
print("\nPc option is: ", pc)
print('u win')
if int(option) == 2 and pc == lista[1]:
print("\nPc option is: ", pc)
print('draw')
if int(option) == 2 and pc == lista[2]:
print("\nPc option is: ", pc)
print('u lost')
if int(option) == 3 and pc == lista[0]:
print("\nPc option is: ", pc)
print('u lost')
if int(option) == 3 and pc == lista[1]:
print("\nPc option is: ", pc)
print('u win')
if int(option) == 3 and pc == lista[2]:
print("\nPc option is: ", pc)
print('draw')
if __name__ == '__main__':
obracun()