-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparouimpar.py
More file actions
27 lines (27 loc) · 837 Bytes
/
Copy pathparouimpar.py
File metadata and controls
27 lines (27 loc) · 837 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
from random import randint
v = 0
while True:
jogador = int(input('Digite um número: '))
computador = randint(0,10)
total = jogador + computador
tipo = ' '
while tipo not in 'PI':
tipo = str(input('Par ou Impar? [P/I]')).strip().upper()[0]
print(f'Você jogou {jogador} e computador jogou {computador}. Total de {total}!! ', end='')
print('Deu PAR' if total % 2 == 0 else 'Deu IMPAR')
if tipo == 'P':
if total % 2 == 0:
print('Você VENCEU')
v += 1
else:
print('Você PERDEU')
break
elif tipo == 'I':
if total % 2 == 1:
print('Você VENCEU')
v += 1
else:
print('Você PERDEU')
break
print('Vamos jogar novamente...')
print(f'GAME OVER! Você venceu {v} vezes')