hi beginner here I'm learning if statement
this my code
print("Welcome to the dungeon.")
print("Your mission is to find the ursine sword.")
level_1 = input("there is two doors infront of you type 'right' for the right door and 'left' for the left door.\n" )
level_1.lower()
if level_1 == "right" :
print("this door is closed your level is too low to open it.\n")
if level_1 == "left" :
level_2 = input("you found a two ladder one leads to upstairs type 'upstairs' and another leads to the basement type 'basement'.\n ")
level_2.lower()
if level_2 == "basement" :
print("hisssssss , you got bitten by snake game over")
if level_2 == "upstairs" :
level_3 =int(input("it seems like the final room thre is three swords infront of you two of them must be traps chose '1','2' or '3' "))
if level_3 == 1 :
print("you released a powerful ghost you'r dead")
elif level_3 == 3 :
print("you opened a portal to a cater you're dead")
elif level_3 == 2 :
print("congratulations you found the ursine sword")
else :
print("game over.")
I tried many other ways to use input but can't describe it the issue is level_2 is undefined when i choose 'right' but if i choose 'left' the code continue with no problem and i can choose 'upstairs' with no issue and continue with level_3 and can choose form 1,2,3 with no issue even though level_3 is inputted like level_2 or am I wrong? #new code
print("Welcome to the dungeon.")
print("Your mission is to find the ursine sword.")
print("Welcome to the dungeon.")
print("Your mission is to find the ursine sword.")
level_1 = input("there is two doors infront of you type 'right' for the right door and 'left' for the left door.\n")
if level_1== "right":
print("this door is closed your level is too low to open it.\n")
elif level_1== "left":
level_2 =input("you found a two ladder one leads to upstairs type 'upstairs' and another leads to the basement type 'basement'.\n ").lower()
if level_2== "basement":
print("hisssssss , you got bitten by snake game over")
elif level_2== "upstairs":
level_3 = int(input("it seems like the final room thre is three swords infront of you two of them must be traps chose '1','2' or '3' "))
if level_3 == 1 :
print("you released a powerful ghost you'r dead")
elif level_3 == 3 :
print("you opened a portal to a cater you're dead")
elif level_3 == 2 :
print("congratulaitons you found the ursine sword")
else :
print("game over.")
this the new code the indentation fixed my issue