第72行我不明白的Python语法错误

时间:2018-12-01 05:12:57

标签: python python-2.7

在第72行,我收到了无效的语法错误,我的朋友和我都不知道为什么。

import random
import time

def displayIntro():
    print("Welcome to hell!")
    print("You may be wondering what you did to deserve this... you'll find out soon enough")
    print("For the momment, you have the option to pick a path.")
    print("There is path 1, which leads west through the firey lakes of damnation.")
    print("Or path 2, which leads through the desert of broken glass and aids needles.")
    print("There's also a 3rd path, but you don't wanna go down that one.")

    do_what = raw_input("> ")

    if "1" in do_what:
        print("You decide to take a swim in the firey lake of damntaion.")
        print("The flesh burns right off your skin and you drown in the lava of sin.")
        print("You die a fast, but extremely painfull death.")
        dead()

    elif "2" in do_what:
        print("You start to walk barefoot on the broken glass and aids needles.")
        print("The desert seems to be endless though, and if the dehydration doesn't kill you, the aids eventually will.")
        print("You die a slow painfull death.")
        dead()

    elif "3" in do_what:
        print("Okay, you chose the boring path.")
        print("As you walk down the empty path, you pass several doors.")
        print("You have the choice of entering one of two doors.")
        print("Door 1 has a 'Do not enter sign' hung on it.")
        print("Door 2 has a welcome sign taped to the front")

        do_what = raw_input("> ")

        if "1" in do_what:
            print("You walk in the room and see Hitler manscaping for Saddam Hussein.")
            print("They are more embarrassed than angry.")
            print("After all, it is hell, but at this point you're not sure what the torture is anymore.")
            time.sleep(2)
            room()

        elif "2" in do_what:
            print("You walk into Satans bedroom.")
            print("He's laying on the bed in a sensual manner.")
            print("As soon as he sees you, he becomes visibly excited.")
            print("Satan ********* you to death...")
            time.sleep(2)
            dead()

def room():
    print("Now you're just chilling - technically burning - in this room with Hitler and Saddam.")
    print("You do not want to spend the rest of eternity with these two ******, so you look around the room.")
    print("Eventually, you notice a pannel in the back of the room.")
    print("On an ajecent wall there is a metal door.")
    print("Or...you can go back the way you came.")
    print("(your options are: door, pannel, or back)")

    do_what = raw_input("> ")

    if "pannel" in do_what:
        print("You crawl into what seems like a bedroom.")
        print("You look up and see Satan.")
        print("He's laying on the bed in a sensual manner.")
        print("As soon as he sees you, he becomes visibly excited.")
        print("Satan *** ***** you to death...")
        time.sleep(2)
        dead()

72. elif "back" in do_what:
        print("You turn around and open the door, a bunch of big *** lions jump out and mall you to death.")
        dead()

    elif "door" in do_what:
        print("You walk through the door and are in a hazy room.")
        print("As you walk farther in you notice that you're in a bank.")
        print("You see yourself a little ways a way.")
        print("You appear to be holding a large gun. And you seem to be pointing it at the teller.")
        print("Then you hear a loud bang.")
        room2()

1 个答案:

答案 0 :(得分:0)

那是因为raw_input()被重命名为input(),我只是在这里运行了您的程序,将其更改为input()而不是raw_input(),并且效果很好。

使用: python --version Python 3.7.1