What is going wrong with my basic text adventure python code?

I am currently in the early days of learning Python and I am attempting to make a very basic text adventure game and believe I have indented and formatted the code correctly however it seems whatever text I input into the game it just follows the same route no matter what? Is there anything you can see which is wrong with my code? Many thanks

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>print('''
*******************************************************************************
| | | |
_________|________________.=""_;=.______________|_____________________|_______
| | ,-"_,="" `"=.| |
|___________________|__"=._o`"-._ `"=.______________|___________________
| `"=._o`"=._ _`"=._ |
_________|_____________________:=._o "=._."_.-="'"=.__________________|_______
| | __.--" , ; `"=._o." ,-"""-._ ". |
|___________________|_._" ,. .` ` `` , `"-._"-._ ". '__|___________________
| |o`"=._` , "` `; .". , "-._"-._; ; |
_________|___________| ;`-.o`"=._; ." ` '`."` . "-._ /_______________|_______
| | |o; `"-.o`"=._`` '` " ,__.--o; |
|___________________|_| ; (#) `-.o `"=.`_.--"_o.-; ;___|___________________
____/______/______/___|o;._ " `".o|o_.--" ;o;____/______/______/____
/______/______/______/_"=._o--._ ; | ; ; ;/______/______/______/_
____/______/______/______/__"=._o--._ ;o|o; _._;o;____/______/______/____
/______/______/______/______/____"=._o._; | ;_.--"o.--"_/______/______/______/_
____/______/______/______/______/_____"=.o|o_.--""___/______/______/______/____
/______/______/______/______/______/______/______/______/______/______/_____ /
*******************************************************************************
''')
print("Welcome to Treasure Island.")
print("Your mission is to find the treasure.")
#https://www.draw.io/?lightbox=1&highlight=0000ff&edit=_blank&layers=1&nav=1&title=Treasure%20Island%20Conditional.drawio#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1oDe4ehjWZipYRsVfeAx2HyB7LCQ8_Fvi%26export%3Ddownload
direction = input("You arrive at a particularly ominous looking crossroad. To your left is a path that leads to a dark forest, the kind that gives you a foreboding feeling just by clasping your eyes on it. Whereas to the right there is a path to, a not much better, road with a mysteriously lit castle in the far distance. Which way do you go? Left or Right? ")
direction = direction.lower()
if direction == "left" or "l":
swim = input("You enter the dark forest hesistantly. You hear the sound of what seems to be flowing water, and for some unknown reason you get an overwhelming urge to turn back. Reluctantly, you proceed onwards and arrive at the bank of a river where you see an island some way further down the stream. Do you try to swim across or wait to see if you can find a different way across? Swim or Wait? ")
swim = swim.lower()
if swim == "wait" or "w":
door = input("You ponder your options for a while, until you suddenly hear the sound of song, a song that you feel you have heard before, the sort that calls you towards it even when you know logically you have never encountered it before. You follow the call of the song and arrive at a small, slightly dishevelled building with three unusual-looking doors. One is encased in a sort of viscous yellow bile with a crest portraying a proud phoenix. Another is adorned with a sort of blue glowing crystal, with a small engraved serpent at the bottom of the door. The last door is easily the most unusual of the three, with particuarly fine embellishments adorning its entire surface area, the stand-out feature is the intricately designed golden handle which constrasts the rest of the purple velvet exterior magnificently. Which door do you choose to enter? Yellow, Blue or Purple? ")
door = door.lower()
if door == "yellow" or "y":
print("You recognise the sign of the phoenix, the bird of immortality and rebirth and realise no danger lies behind that door. You open it and are greeted by the most wondrous sight known to man; endless treasure illuminating the room with a bright, yellow light for as far as the eyes can see. You have found the treasure! Congratulations! Now go and find some real treasure ;)")
elif door == "blue" or "b":
print("You open the door and are met with a bright blue beam of light, which pierces through your heart and you are suddenly transported to a room full of water. You are dragged down to the bottom by a ceasless pulling force where you succumb to your watery grave. Game over.")
elif door == "purple" or "p":
print("You open the door to find a proud knight standing before you. He is wearing a crown of gold and fine suit of purple armour. Initially, he stands motionless, looking at the ground. He slowly turns his gaze to you... you feel an unbearable wave of coldness wash over your entire body as his eyes meet yours. 'You do not belong here, you come seeking the treasure but you do not even know what it is you truly seek,' he lets out an exasperated sigh. 'Alas, I will end your measly life, in the hope you will reborn as someone with purpose'. He proceeds to pierce his 2-metre long sword through your neck. As you slowly bleed out, you begin to think... I should have chose a different door. Game over. ")
else:
print("You need to learn how to follow simple instructions. For your ineptitude you have been struck by a lightning bolt from Zeus out of sheer pity. Please try to be better. Game over.")
elif swim == "swim" or "s":
print("You enter the ice-cold water and begin to swim across. You feel the water gushing past your legs, and the tremendous resistance of the currents make you feel like you are sinking. You try to swim faster, but the currents are too strong for your meagre body to handle. You are dragged down by the currents where a giant trout swallows you whole, mistaking you for a little fish. Game over.")
else:
print("I thought you knew how to read. My mistake. I will end this game for you now and wait until you have the intellect to handle the simplest of instructions. If you fail to understand this statement, please contact your carer/guardian to let them explain to you what has happened. Game over.")
elif direction == "right" or "r":
print("You enter the castle, where you are greeted by a large, ominously-lit great hall. A man in a cloaked hood stands before you, his eyes glowing with a strange, unnatural light. His hood is adorned with a mysterious animal, a cross between a serpent and man. He looks upon you with utter disdain, and you feel a chill down your spine which courses through the rest of your body. He proceeds to walk towards you, and in one sudden pounce sinks his cold, black claws into your neck. You are dead. Game over.")
else:
print("If you cannot get past the first question without making a mistake, then you are not worthy of the treasure. May I suggest a game more suited to your abilities? Perhaps, Snakes and Ladders is more up your alley. Game over.")
</code>
<code>print(''' ******************************************************************************* | | | | _________|________________.=""_;=.______________|_____________________|_______ | | ,-"_,="" `"=.| | |___________________|__"=._o`"-._ `"=.______________|___________________ | `"=._o`"=._ _`"=._ | _________|_____________________:=._o "=._."_.-="'"=.__________________|_______ | | __.--" , ; `"=._o." ,-"""-._ ". | |___________________|_._" ,. .` ` `` , `"-._"-._ ". '__|___________________ | |o`"=._` , "` `; .". , "-._"-._; ; | _________|___________| ;`-.o`"=._; ." ` '`."` . "-._ /_______________|_______ | | |o; `"-.o`"=._`` '` " ,__.--o; | |___________________|_| ; (#) `-.o `"=.`_.--"_o.-; ;___|___________________ ____/______/______/___|o;._ " `".o|o_.--" ;o;____/______/______/____ /______/______/______/_"=._o--._ ; | ; ; ;/______/______/______/_ ____/______/______/______/__"=._o--._ ;o|o; _._;o;____/______/______/____ /______/______/______/______/____"=._o._; | ;_.--"o.--"_/______/______/______/_ ____/______/______/______/______/_____"=.o|o_.--""___/______/______/______/____ /______/______/______/______/______/______/______/______/______/______/_____ / ******************************************************************************* ''') print("Welcome to Treasure Island.") print("Your mission is to find the treasure.") #https://www.draw.io/?lightbox=1&highlight=0000ff&edit=_blank&layers=1&nav=1&title=Treasure%20Island%20Conditional.drawio#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1oDe4ehjWZipYRsVfeAx2HyB7LCQ8_Fvi%26export%3Ddownload direction = input("You arrive at a particularly ominous looking crossroad. To your left is a path that leads to a dark forest, the kind that gives you a foreboding feeling just by clasping your eyes on it. Whereas to the right there is a path to, a not much better, road with a mysteriously lit castle in the far distance. Which way do you go? Left or Right? ") direction = direction.lower() if direction == "left" or "l": swim = input("You enter the dark forest hesistantly. You hear the sound of what seems to be flowing water, and for some unknown reason you get an overwhelming urge to turn back. Reluctantly, you proceed onwards and arrive at the bank of a river where you see an island some way further down the stream. Do you try to swim across or wait to see if you can find a different way across? Swim or Wait? ") swim = swim.lower() if swim == "wait" or "w": door = input("You ponder your options for a while, until you suddenly hear the sound of song, a song that you feel you have heard before, the sort that calls you towards it even when you know logically you have never encountered it before. You follow the call of the song and arrive at a small, slightly dishevelled building with three unusual-looking doors. One is encased in a sort of viscous yellow bile with a crest portraying a proud phoenix. Another is adorned with a sort of blue glowing crystal, with a small engraved serpent at the bottom of the door. The last door is easily the most unusual of the three, with particuarly fine embellishments adorning its entire surface area, the stand-out feature is the intricately designed golden handle which constrasts the rest of the purple velvet exterior magnificently. Which door do you choose to enter? Yellow, Blue or Purple? ") door = door.lower() if door == "yellow" or "y": print("You recognise the sign of the phoenix, the bird of immortality and rebirth and realise no danger lies behind that door. You open it and are greeted by the most wondrous sight known to man; endless treasure illuminating the room with a bright, yellow light for as far as the eyes can see. You have found the treasure! Congratulations! Now go and find some real treasure ;)") elif door == "blue" or "b": print("You open the door and are met with a bright blue beam of light, which pierces through your heart and you are suddenly transported to a room full of water. You are dragged down to the bottom by a ceasless pulling force where you succumb to your watery grave. Game over.") elif door == "purple" or "p": print("You open the door to find a proud knight standing before you. He is wearing a crown of gold and fine suit of purple armour. Initially, he stands motionless, looking at the ground. He slowly turns his gaze to you... you feel an unbearable wave of coldness wash over your entire body as his eyes meet yours. 'You do not belong here, you come seeking the treasure but you do not even know what it is you truly seek,' he lets out an exasperated sigh. 'Alas, I will end your measly life, in the hope you will reborn as someone with purpose'. He proceeds to pierce his 2-metre long sword through your neck. As you slowly bleed out, you begin to think... I should have chose a different door. Game over. ") else: print("You need to learn how to follow simple instructions. For your ineptitude you have been struck by a lightning bolt from Zeus out of sheer pity. Please try to be better. Game over.") elif swim == "swim" or "s": print("You enter the ice-cold water and begin to swim across. You feel the water gushing past your legs, and the tremendous resistance of the currents make you feel like you are sinking. You try to swim faster, but the currents are too strong for your meagre body to handle. You are dragged down by the currents where a giant trout swallows you whole, mistaking you for a little fish. Game over.") else: print("I thought you knew how to read. My mistake. I will end this game for you now and wait until you have the intellect to handle the simplest of instructions. If you fail to understand this statement, please contact your carer/guardian to let them explain to you what has happened. Game over.") elif direction == "right" or "r": print("You enter the castle, where you are greeted by a large, ominously-lit great hall. A man in a cloaked hood stands before you, his eyes glowing with a strange, unnatural light. His hood is adorned with a mysterious animal, a cross between a serpent and man. He looks upon you with utter disdain, and you feel a chill down your spine which courses through the rest of your body. He proceeds to walk towards you, and in one sudden pounce sinks his cold, black claws into your neck. You are dead. Game over.") else: print("If you cannot get past the first question without making a mistake, then you are not worthy of the treasure. May I suggest a game more suited to your abilities? Perhaps, Snakes and Ladders is more up your alley. Game over.") </code>
print('''
*******************************************************************************
          |                   |                  |                     |
 _________|________________.=""_;=.______________|_____________________|_______
|                   |  ,-"_,=""     `"=.|                  |
|___________________|__"=._o`"-._        `"=.______________|___________________
          |                `"=._o`"=._      _`"=._                     |
 _________|_____________________:=._o "=._."_.-="'"=.__________________|_______
|                   |    __.--" , ; `"=._o." ,-"""-._ ".   |
|___________________|_._"  ,. .` ` `` ,  `"-._"-._   ". '__|___________________
          |           |o`"=._` , "` `; .". ,  "-._"-._; ;              |
 _________|___________| ;`-.o`"=._; ." ` '`."` . "-._ /_______________|_______
|                   | |o;    `"-.o`"=._``  '` " ,__.--o;   |
|___________________|_| ;     (#) `-.o `"=.`_.--"_o.-; ;___|___________________
____/______/______/___|o;._    "      `".o|o_.--"    ;o;____/______/______/____
/______/______/______/_"=._o--._        ; | ;        ; ;/______/______/______/_
____/______/______/______/__"=._o--._   ;o|o;     _._;o;____/______/______/____
/______/______/______/______/____"=._o._; | ;_.--"o.--"_/______/______/______/_
____/______/______/______/______/_____"=.o|o_.--""___/______/______/______/____
/______/______/______/______/______/______/______/______/______/______/_____ /
*******************************************************************************
''')
print("Welcome to Treasure Island.")
print("Your mission is to find the treasure.")

#https://www.draw.io/?lightbox=1&highlight=0000ff&edit=_blank&layers=1&nav=1&title=Treasure%20Island%20Conditional.drawio#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1oDe4ehjWZipYRsVfeAx2HyB7LCQ8_Fvi%26export%3Ddownload

direction = input("You arrive at a particularly ominous looking crossroad. To your left is a path that leads to a dark forest, the kind that gives you a foreboding feeling just by clasping your eyes on it. Whereas to the right there is a path to, a not much better, road with a mysteriously lit castle in the far distance. Which way do you go? Left or Right? ")
direction = direction.lower()
if direction == "left" or "l":
          swim = input("You enter the dark forest hesistantly. You hear the sound of what seems to be flowing water, and for some unknown reason you get an overwhelming urge to turn back. Reluctantly, you proceed onwards and arrive at the bank of a river where you see an island some way further down the stream. Do you try to swim across or wait to see if you can find a different way across? Swim or Wait? ")
          swim = swim.lower()
          if swim == "wait" or "w":
                    door = input("You ponder your options for a while, until you suddenly hear the sound of song, a song that you feel you have heard before, the sort that calls you towards it even when you know logically you have never encountered it before. You follow the call of the song and arrive at a small, slightly dishevelled building with three unusual-looking doors. One is encased in a sort of viscous yellow bile with a crest portraying a proud phoenix. Another is adorned with a sort of blue glowing crystal, with a small engraved serpent at the bottom of the door. The last door is easily the most unusual of the three, with particuarly fine embellishments adorning its entire surface area, the stand-out feature is the intricately designed golden handle which constrasts the rest of the purple velvet exterior magnificently. Which door do you choose to enter? Yellow, Blue or Purple? ")
                    door = door.lower()
                    if door == "yellow" or "y":
                              print("You recognise the sign of the phoenix, the bird of immortality and rebirth and realise no danger lies behind that door. You open it and are greeted by the most wondrous sight known to man; endless treasure illuminating the room with a bright, yellow light for as far as the eyes can see. You have found the treasure! Congratulations! Now go and find some real treasure ;)")
                    elif door == "blue" or "b":
                              print("You open the door and are met with a bright blue beam of light, which pierces through your heart and you are suddenly transported to a room full of water. You are dragged down to the bottom by a ceasless pulling force where you succumb to your watery grave. Game over.")
                    elif door == "purple" or "p":
                              print("You open the door to find a proud knight standing before you. He is wearing a crown of gold and fine suit of purple armour. Initially, he stands motionless, looking at the ground. He slowly turns his gaze to you... you feel an unbearable wave of coldness wash over your entire body as his eyes meet yours. 'You do not belong here, you come seeking the treasure but you do not even know what it is you truly seek,' he lets out an exasperated sigh. 'Alas, I will end your measly life, in the hope you will reborn as someone with purpose'. He proceeds to pierce his 2-metre long sword through your neck. As you slowly bleed out, you begin to think... I should have chose a different door. Game over. ")
                    else:
                              print("You need to learn how to follow simple instructions. For your ineptitude you have been struck by a lightning bolt from Zeus out of sheer pity. Please try to be better. Game over.")
          elif swim == "swim" or "s":
                    print("You enter the ice-cold water and begin to swim across. You feel the water gushing past your legs, and the tremendous resistance of the currents make you feel like you are sinking. You try to swim faster, but the currents are too strong for your meagre body to handle. You are dragged down by the currents where a giant trout swallows you whole, mistaking you for a little fish. Game over.")
          else:
                    print("I thought you knew how to read. My mistake. I will end this game for you now and wait until you have the intellect to handle the simplest of instructions. If you fail to understand this statement, please contact your carer/guardian to let them explain to you what has happened. Game over.")
elif direction == "right" or "r":
          print("You enter the castle, where you are greeted by a large, ominously-lit great hall. A man in a cloaked hood stands before you, his eyes glowing with a strange, unnatural light. His hood is adorned with a mysterious animal, a cross between a serpent and man. He looks upon you with utter disdain, and you feel a chill down your spine which courses through the rest of your body. He proceeds to walk towards you, and in one sudden pounce sinks his cold, black claws into your neck. You are dead. Game over.")
else:
    print("If you cannot get past the first question without making a mistake, then you are not worthy of the treasure. May I suggest a game more suited to your abilities? Perhaps, Snakes and Ladders is more up your alley. Game over.")

I have tried to repeatedly make sure the indentations are all correct and all of the if-elif-else statements are nested correctly and I still can’t understand where the problem is arising from.

New contributor

carlsenesque12 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật