-1
I’m making a program that draws a number from 0 to 5 and the user should guess what it is, but he only has 3 attempts. In case the 3 attempts run out and the user does not guess which is the number, then would show a message saying that exceeded the number of attempts and whether wanted to quit or continue playing, the problem is that come have a loop inside the other if the user type "more" the "continue" assumes I want to return the input saying I tried too many times and not the entire code:
import random
import time
from sys import exit
print('-------------------')
print('JOGO DA ADIVINHAÇÃO')
print('-------------------')
time.sleep(2)
print('Vou pensar num número de 0 a 5...')
time. sleep(1)
tentativa=3
num=random.randint(0, 5)
while True:
n= int(input('Tente adivinhar qual é: '))
if tentativa >0:
if num==n:
print('Você ACERTOU! PARABÉNS!')
break
elif num!=n:
n2=input(f'Você errou, tem {tentativa}...')
tentativa=tentativa-1
continue
elif tentativa==0:
while True:
se=input('Você tentou vezes demais e não acertou digite "mais" para jogar novamente ou "sair" para acabar o jogo: ')
if se=='sair':
exit()
elif se=='mais':
continue
elif se!='mais' or se!= 'sair':
print('Não percebi o que quis dizer...')
time.sleep(2)
continue
How do I make the whole code start again?