im creating an option button that can expand into multiple options to narrow down what the user wants to search, i havent found a function similar to what i want to achieve and tried using while and if-else to attempt it
it worked for the first layer of questions but when i tried to add more if-else within the option it keeps showing expected indented block for the else line.
Has anyone found a workaround or am i misunderstanding if-else statements?
load_titanic("titanic.csv")
print("Welcome to the Titanic Dataset Explorer")
option = "A"
while option.upper() != "Q":
print()
print("Select an option")
print("(1) Display number of families that embarked from each port")
# (1) cherboug: , queenstown: , southampton:
print("(2) Display families boat status")
# (2) display no. fam same boat, no. fam diff boat, no. of fam no boat
print("(Q) Quit")
option = input("> ")
print()
# add additional option as terminal cannot load all
if option == "1":
option2 = "B"
while option2.upper() != "Return":
print()
print("Select Display Method")
print("(1)Display Only Cherboug Passengers")
print("(2)Display Only Queenstown Passengers")
print("(3)Display Only Southampton Passengers")
print("(4)Display All")
print("(R)Return")
option2 = input("> ")
print()
if option2 == "1":
display_fam_boat_stat()
elif option2 == "2":
display_fam_boat_stat()
elif option2 == "3":
display_fam_boat_stat()
elif option2 == "4":
display_fam_embkall()
elif option2.upper() == "R":
else: <Expected indented block
print("Invalid option")
print()
elif option == "2":
display_fam_boat_stat()
elif option.upper() == "Q":
print("Thank you for using the Titanic Dataset Explorer")
else:
print("Invalid option")
print()