Ogólnie plik lekko niepythonowy i stworzyłeś Piramid of Doom ale to mało ważne.
Co najważniejsze masz błąd w instrukcji "if", konkretnie tej:
if cabinet_no == "no":
Ten warunek będzie zawsze spełniony.
Jednorazowe inputy też możesz zawrzeć w instrukcji if jeśli nie mają zostać zapamiętane - nie używasz jakiegoś systemu flag, ale tam gdzie masz dwie opcje z czego jedną definiujesz, pozostałe to else, będzie to miało swoje zastosowanie.
Dobrze wziąć pod uwagę że ktoś może wprowadzić słowo dużymi literami, wtedy wypadałoby również je zczytać.
Ponadto linie się mogą kiepsko sklejać na niektórych komputerach, warto wymusić łamanie linii w porządanych miejscach znakiem: '\n' (bez apostrofów oczywiście, to znak nowej linii, pisany dwoma znakami)
Tam gdzie masz potrójne znaki oznaczające stringa, wystarczy bez znaku przełamać linię.
Gdy wykorzystujesz pętle "while True" ona w twoim programie i tak wykona się tylko raz, nie przećwiczyłeś nic jeśli o to ci chodziło. Ponieważ każdy twój wybór kończy się poleceniem break, z wyjątkiem złego wprowadzenia argumentów. Zaś po poprawie twojego cabinet_no które się odbywało zawsze, nie masz możliwości na kolejny wybór po ścieżce w lewo.
Jakbyś chciał jakieś inne ćwiczenia do pętli, mogę ci podrzucić jakieś moje stare ćwiczenia do analizy kodu :)
Ja bym ujął to w ten sposób, spróbuj dojrzeć różnicę:
def main():
print("...:::the fucking journey of bob:::...)".upper())
print ("4 walls 1 door try too escape")
print ("You wake up in a small room, no windows only one door.")
start()
def start():
while True:
choice_of_looking = input("In front of you is a locked door. Looks like you gonna need a key.\nWhat you gonna do? Look left or right: ").lower()
if choice_of_looking == "right":
print("You see a door and a big ass cabin. \nThe door is locked, you try to open the cabinet with falls on you and you die :3 \n\t\t~the end")
break
elif not choice_of_looking == "left":
print("Don't fuck with me Bob")
continue
while choice_of_looking == "left"
print("You see a bed and a small cabinet")
choice_cabinet=input("Look in the cabinet?\nyes or no: ").lower()
if choice_cabinet == "no":
print ("Kk not pushing on you Bobby. \n'Bam Bam' Look's like the noise is coming from the big ass cabin.\nTap tap going looking what it is.It is a big black python. Which eat you in one bite :3 \n\t\t~the end")
elif choice_cabinet == "yes":
print("OMFG Bobby there is a gun in the cabinet. \n'Bam Bam' Look's like the noise is coming from the big ass cabin. \nTap tap going looking what it is. \nIt is a big black python. You take the gun and BANG BANG BANG the python is dead and he got the key to the door :3 \n\t\t~the end ")
break
break
if __name__=="__main__":
main()
@Edit:
Ah, zapomniałem, by uniknąć pyramid of doom warto też sobie rozdzielić to na funkcje :). Miałem w schowku kod we wcześniejszej wersji, podrzucam skopiowany ten poprawny poniżej:
def main():
print("...:::the fucking journey of bob:::...)".upper())
print ("4 walls 1 door try too escape")
print ("You wake up in a small room, no windows only one door.")
start()
def start():
while True:
choice_of_looking = input("In front of you is a locked door. Looks like you gonna need a key.\nWhat you gonna do? Look left or right: ").lower()
if choice_of_looking == "right":
right_looking()
break
elif choice_of_looking == "left":
left_looking()
break
else:
print("Don't fuck with me Bob")
continue
break
def right_looking():
print("You see a door and a big ass cabin. \nThe door is locked, you try to open the cabinet with falls on you and you die :3 \n\t\t~the end")
def left_looking():
print("You see a bed and a small cabinet")
choice_cabinet=input("Look in the cabinet?\nyes or no: ").lower()
while True:
if choice_cabinet == "no":
print ("Kk not pushing on you Bobby. \n'Bam Bam' Look's like the noise is coming from the big ass cabin.\nTap tap going looking what it is.It is a big black python. Which eat you in one bite :3 \n\t\t~the end")
break
elif choice_cabinet == "yes":
print("OMFG Bobby there is a gun in the cabinet. \n'Bam Bam' Look's like the noise is coming from the big ass cabin. \nTap tap going looking what it is. \nIt is a big black python. You take the gun and BANG BANG BANG the python is dead and he got the key to the door :3 \n\t\t~the end ")
break
else:
print("Please repead.")
choice_cabinet=input("Look in the cabinet?\nyes or no: ").lower()
if __name__=="__main__":
main()