0

I'm trying to make a question and answer quiz game, but I want to make sure that the player is inputting a valid answer and make sure that they cannot move past the question unless they give me a, b, c, or d.

My code so far is like this

    for key in questions:
        print()
        print(key)
        for i in options[question_num-1]:
            print(i)
        guess = ""
        while guess != "A" or "B" or "C" or "D":
            print("Please input valid answer.")
            guess = str.upper(input("What is your answer?: "))
        else:
            guesses.append(guess)
            correct_guesses += check_answer(questions.get(key),guess)
            question_num += 1

My thought process is while the guess is not A, B, C, or D, it will keep asking them to input a valid response. However, even when I put in "a", which should automatically change to "A" (which is a valid response), it still keeps me in the while loop. Am I thinking about it wrong or am I messing up somewhere?

Brian Wang
  • 11
  • 1
  • Your while loop seems not indented properly, but do you know about ipdb debugger ? https://stackoverflow.com/questions/35613249/using-ipdb-to-debug-python-code-in-one-cell-jupyter-or-ipython – L4ur3nt Sep 15 '22 at 18:42

0 Answers0