-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParOuImpar.py
More file actions
28 lines (26 loc) · 765 Bytes
/
Copy pathParOuImpar.py
File metadata and controls
28 lines (26 loc) · 765 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
from random import randint
v = 0
while True:
jogador = int(input('Digite um valor: '))
compu = randint(0, 10)
total = jogador + compu
tipo = ' '
while tipo not in 'PI':
tipo = str(input('Par ou Ímpar: [P/I]')).strip().upper()[0]
print(f'Jogador {jogador} e computador {compu}. Total {total}')
print('Par' if total % 2 == 0 else 'Impar')
if tipo == 'P':
if total % 2 == 0:
print('Você venceu!')
v += 1
else:
print('PERDEU')
break
elif tipo == 'I':
if total % 2 == 1:
print('Você venceu!')
v += 1
else:
print('PERDEU')
break
print(f'GAMER OVER. Você venceu {v} vezes.')