I'm quite new to Python and need help with my nested if else statements. For some reason, when I enter an input on the "enginesWide" question, it doesn't go to the correct if statement. For example, if I type in "wide" for the fuselage question, and then input "4" for the enginesWide question, it goes to the if else statement for when a user actually inputs "2".
Below is the code:
print("Hello! Welcome to the Plane-dentifier! My purpose is to identify the plane you are looking at through the features you can see!")
fuselage = input("Is the plane you are looking wide-body or narrow-body? ").lower()
#wide-body
if fuselage == "wide body" or "wide-body" or "wide":
#engines for wide-body
engineWide = input("Alright! How many engines does it have? 4 or 2? ").lower()
#two engines
if engineWide == "2" or "two":
buldgeFuselage = input("Does it have a bulge at the bottom of the fuselage? ").lower()
#four engines
elif engineWide == "4" or "four":
doubleDecker = input("Is it double-decker? ").lower()
if doubleDecker == "yes":
#partial or full deck
doubleDeckFeature = input("Does the plane have a partial double-deck or a full double-deck? ").lower()
#747
if doubleDeckFeature == "partial" or "partial double deck" or "partial double-deck":
print("The plane you are looking at is a Boeing 747! Thank you for using the bot.")
#A380
elif doubleDeckFeature == "full" or "full double deck" or "full double-deck":
print("The plane you are looking at is an Airbus A380! Thank you for using the bot.")
#A340
elif doubleDecker == "no":
print("The plane you are looking at is an Airbus A340! Thank you for using the bot.")
Aucun commentaire:
Enregistrer un commentaire