-2

As if u guys compile the code, even though my if statement and my while loop are right, they aren't working together, please help me

 question_1_prologue = input("Are you ready to help me save the world?\na) Of course\nb) No\n")
    print()

while question_1_prologue != "a" or "A" or "a)" or "A)":
  print ("This game was not made for you")
  break

if question_1_prologue == "a" or "A" or "a)" or "A)":
  print ('Good choice, heroes never die')

the "Good choice, heroes never die" is working when we input a, but if u input anything different, you will get both messages "Heroes never die" and also "This game was not made for you"

V2P
  • 21
  • 5
  • 1
    Can you add what the error is that you are getting? – Parakiwi Mar 11 '20 at 01:36
  • the `print()` after the user input is unnecessary, you can remove that. and the menu options seem to be the same so either way it will always `break` in that while loop and never get to the `if` statement. – de_classified Mar 11 '20 at 01:42

1 Answers1

2
while question_1_prologue != "a" or "A" or "a)" or "A)":

is the same as

 while (question1_prolog != "a") or ("A") or ("a)") or ("A)"):

which is the same as

 while (question1_prolog != "a") or (True) or (True) or (True):

instead maybe try

 while not question1_prolog.lower().startswith("a"):
Joran Beasley
  • 110,522
  • 12
  • 160
  • 179
  • Hey Jorean, so, the ´´´if question_1_prologue == "a" or "A" or "a)" or "A)": print ('Good choice, heroes never die')´´´ worked, but the other one is still printing both answers "This game was not made for you" and "Good choice, heroes never die", when it should answer only "This game was not made for you" . – V2P Mar 11 '20 at 01:46