Whenever I run the following code, the outcome is always an if statement outcome, even if its meant to be for else. For example, I am asking the user to enter the unlocking charm (in Harry Potter), and if they do so, they can proceed with the rest of the quiz, but if they fail to do so, the quiz does not come up and they cannot complete the rest of it. However, in my program even if the person has done the wrong spell, they get a message saying good luck on the quiz and the quiz starts for them. How do I make it that if the person enters the wrong spell, the quiz ends for them, and they get a message telling them they failed the quiz instead of giving them luck on completing it. This is the piece of code that I have written and i can not find out where the issue is.
revealingcharm = input("Enter the unlocking charm to reveal the quiz:")
if revealingcharm == "alohomora": print ("Here is one bottle of Felix Felicis for luck.") else: print("You failed to reveal the quiz and have no quiz to complete.") (exit)
Aucun commentaire:
Enregistrer un commentaire