This repository was archived by the owner on Nov 23, 2021. It is now read-only.
forked from jordanbaez/DA_exercises
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscissors
More file actions
55 lines (41 loc) · 1.24 KB
/
scissors
File metadata and controls
55 lines (41 loc) · 1.24 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
import random
foo = [1, 2, 3]
turn = 0
victory = 3
computer_wins = 0
my_wins=0
#shots = 0
#max_shots = 2
turn += 1
while (computer_wins < victory) & (my_wins<victory):
ordinateur = random.choice(foo)
ordi = int(ordinateur)
my_choice = input('choose 1, 2, or 3 : ')
while my_choice.isdigit() == False:
#shots+=1
print('select 1 number between 1 and 3 only.') #,(max_shots-shots),'left before game over.')
my_choice = input('choose 1, 2, or 3 : ')
#if shots == max_shots:
#print('too many wrong answers. game over.') #limiting the number of possible shots
#flag=True
#return
moi = int(my_choice)
print(ordi)
print(moi)
if ((ordi == 1) & (moi == 1)) | ((ordi == 2) & (moi == 2))| ((ordi == 3) & (moi == 3)):
turn += 1
print('tie')
elif ((ordi == 2) & (moi == 1)) |((ordi == 3) & (moi == 2)) | ((ordi == 1) & (moi == 3)):
turn += 1
computer_wins +=1
print('computer wins')
#elif ((ordi == 1) & (moi == 2))|((ordi == 2) & (moi == 3)) | ((ordi == 3) & (moi == 1)):
else:
turn += 1
my_wins +=1
print('I win')
print(computer_wins, 'vs',my_wins)
if (computer_wins == victory) :
print('Computer won')
elif (my_wins==victory):
print('I won')