0
I’m making a simple pair or odd python game that doesn’t perform correctly!
When the player wins, the game does not ask again if he that even or odd! How can I solve?
from random import randint
P_OU_I = ' '
v = 0
while True:
player = int(input('Digite um valor: '))
computador = randint(0, 10)
total = player + computador
while P_OU_I not in 'PI':
P_OU_I = str(input('Par ou ímpar: [P/I] ')).strip().upper()[0]
print(f'Você jogou {player} e o computador {computador}. Total de {total}')
if P_OU_I == 'P':
if total % 2 == 0:
print('Você VENCEU!')
v = v + 1
else:
print('Você PERDEU!')
break
elif P_OU_I == 'I':
if total % 2 == 1:
print('Você VENCEU!')
v = v + 1
else:
print('Você PERDEU!')
break
print('Vamos jogar novamente...')
print(f'GAME OVER! Você venceu {v}')
What were your attempts? I suggest edit your question and add those details. Ah! before anything else gives a glance, how to create a [Mre] so you can elaborate a good question and the chances of it being closed (ie have no chance of receiving answers) greatly reduces!
– gleisin-dev