-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathEX - 68.py
29 lines (29 loc) · 849 Bytes
/
EX - 68.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
from random import randint
print('-='*15)
print('{:^30}'.format('VAMOS JOGAR PAR OU IMPAR'))
print('-='*15)
v = 0
while True:
gamer = int(input('Diga um valor: '))
pc = randint(0, 10)
soma = gamer + pc
tipo = ' '
while tipo not in 'PI':
tipo = str(input('Par ou Impar? [P / I]: ')).strip().upper()[0]
print(f'O computador digitou {pc} e o jogador {gamer}. Total {soma}', end=' ')
print('DEU PAR' if soma % 2 == 0 else 'DEU IMPAR')
if tipo == 'P':
if soma % 2 == 0:
print('Você VENCEU!')
v += 1
else:
print('Você PERDEU!')
break
if tipo == 'I':
if soma % 2 == 1:
print('Você VENCEU!')
v += 1
else:
print('Você PERDEU!')
break
print(f'GAME OVER!. Você venceu {v} vezes')