Help with the while loop in a Python quiz

Asked

Viewed 14 times

0

The intention is if the answer is s he executes that completed the registration successfully, but if it is n or other than s prints the message: registration canceled or thank you and come back soon!.

resposta = ''
while (resposta.upper() != 's'):
    resposta = input('Confirma seu cadastro? ')
    if resposta == 's':
        break
    print('Cadastro efetuado com sucesso!')

    else:
        if resposta != 's' or resposta == 'n':
        print('agradeçemos por seu interesse, volte logo!') 
  • resposta = ''
while (resposta.upper() != 's'):
 resposta = input('Confirma seu cadastro? ')
 if resposta == 's':
 
 print('Cadastro efetuado com sucesso!')
 break

 elif(resposta != 's' or resposta == 'n'):
 print('agradeçemos por seu interesse, volte logo!') test this

  • 1

    Luiz Augusto, thanks friend, gave it right.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.