Python is not reading a conditional within a conditional

Asked

Viewed 29 times

0

Hello, I’m playing a game of questions and in the part that the player misses I want to put an option to try again or not but Python does not read or execute the conditional inside Else. I thought of the code like this:

while True:
    frase1 = input('"Lastimável discípulo, que não ultrapassa o mestre."\nQUEM DISSE ISSO?\na)Leonardo da Vinci\nb)Meu pai\nc)Seu pai\nd)Steve Jobs\n')

    if frase1 == ('a' or 'Leonardo da Vinci' or 'leonardo da vinci'):
        print('Parabéns!\nVocê acertou!')
        pontuacao += 1
        break

    elif frase1 == ('b'):
        print('NÃO FALA NO MEU PAI!\n')

    else:
        falha1 = input('Você errou.\nTentar novamente?\nSim ou Não. ')

        if falha1 == ('Sim' or 's'):
            print('Recomeça o jogo!\n')

        elif falha1 == ('Não' or 'Nao' or 'n'):
            print('Obrigado por jogar.')
            quit()

  • Duplicate of https://answall.com/q/353470/5878

  • But what’s the mistake?

  • Whoa, I don’t quite understand how this post you sent me can help me. Since the problem is not in the first conditional but in the conditional Else-if

  • 1

    @luczin So try [Dit] your question and explain which problem you are facing

  • The error is that python does not recognize the second conditional, when I hit the run and get to the yes or no part, by putting yes or no it simply repeats instead of executing what was requested.

  • I edited the question, I hope you can understand better now,

  • 2

    Virtually all the conditions you made are wrong and in this link I show you why (and how to fix);

  • @Woss I’m trying to understand how to apply what you gave me to my project; could you give me a help? I started using Python yesterday.

  • @Woss I saw where I went wrong this time and got it right. Thank you very much. Thank you to others too.

Show 4 more comments
No answers

Browser other questions tagged

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