Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 我有一个语法错误_Python_Syntax - Fatal编程技术网

Python 我有一个语法错误

Python 我有一个语法错误,python,syntax,Python,Syntax,我在上遇到语法错误 如果first2==1: import time name = raw_input("What is your name? ") print "Hello, " + name time.sleep(1.5) print "Welcome to Kill the Dragon." time.sleep(2) print "In this game, you will choose an option, and if you make the right choic

我在上遇到语法错误

如果first2==1:

import time

name = raw_input("What is your name? ")

print "Hello, " + name

time.sleep(1.5)

print "Welcome to Kill the Dragon."

time.sleep(2)

print "In this game, you will choose an option, and if you make the right 
choices, you will slay the dragon."

time.sleep(5)

print "You are walking through a forest on a cold, damp, windy night."

time.sleep(3)

print "You see a castle, and as you are looking for a shelter, you decide to try your luck there."

time.sleep(3)

print "You are greeted by a knight in shining armor. He gives you a questioning look. What do you say?"

time.sleep(1)

first = int(raw_input("1: Say you are looking for shelter from the storm " "\n2: Say you are lost and need food "))

time.sleep(2)

if first == 1:

    print "Ok, " + name +  ",we could all use some help from this bad storm outside. Please let me lead you to a good place."

    time.sleep(4)

    print "After a good dinner, you ask if there is anything you can do to help."

    time.sleep(2)

print "Well... There is one thing you can do. A dragon located in Eucalyptus Cave has been causing many problems lately./nIf you kill the dragon, we will give you a large reward."

time.sleep(1)

first2 = int(raw_input("1. Tell the knight you will kill the dragon.\n2. Tell the knight you will not kill the dragon. ")

if first2 == 1:
             print "Oh, good. If you had declined, we would have thrown you into the dungeons.

if first2 == 2:
             print "You will not kill the dragon for us? Off to the dungeons it is!"
             time.sleep(1.2)
             print "SLAM!"

if first == 2:

    print "Ugg, I hate filthy peasants! Maybe if you kill the dragon living in that cave over there, we will let you stay."
    time.sleep(4)

    second2 = int(raw_input("1: Insist on getting inside the castle" + "\n2: Ask the knight for armor, a weapon, and a steed"))   
    if second2 == 1:
        print "The knight tells you to get lost, and that the deal is off."
    if second2 == 2:
        print "The knight gives you things, and you set out to slay the dragon."
        time.sleep(3)

        second3 = raw_input ("Once you arrive at the cave, you see two ways to go. Should you go right or left? ")

        if second3 == "right":
            print "You are greeted by the carcusses of many older knights who died trying to battle the dragon. \nYou wish you didn't see it, and turn back to go the other way."
            second3 = "left"     
        if second3 == "left":
            print "You are greeted by the sleeping, green, slimy, two-headed dragon. \n He is sleeping, but he smells you and wakes up. \nHe is about to stand up. \nWhat do you do? "
在末尾添加引号

if first2 == 1:
         print "Oh, good. If you had declined, we would have thrown you into the dungeons."

请注意文章中的语法突出显示如何准确地显示错误。如果你的编辑器不这样做,那就找一个更好的编辑器(用于Python)。我只想说这篇文章是在我11岁的时候,我在用TextEdit:facepalm:我为这个问题的愚蠢道歉,当时我才11岁
if first2 == 1:
         print "Oh, good. If you had declined, we would have thrown you into the dungeons."