Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/301.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 - Fatal编程技术网

Python 请解决这个错误

Python 请解决这个错误,python,Python,elif answerthree==“去加油站”:与任何都不匹配,如果你读了吗?,而True没有冒号(:),你的代码很乱。你可以考虑把它分成不同的类和函数。“quite”是相当慷慨的。你不能elifawhile它的缩进匹配了一段时间,但是。。。过了一会儿就没有了:)你能给我看看吗?对不起,我昨天才学会python的基础知识(只有5个小时),我编辑了答案。但就像其他人告诉你的一样-elif应该匹配另一个if子句的缩进。否则这是一个语法错误。还有没有更简单的方法来组织这个 File "<std

elif answerthree==“去加油站”:
与任何
都不匹配,如果

你读了吗?
,而True
没有冒号(:),你的代码很乱。你可以考虑把它分成不同的类和函数。“quite”是相当慷慨的。你不能
elif
a
while
它的缩进匹配了一段时间,但是。。。过了一会儿就没有了:)你能给我看看吗?对不起,我昨天才学会python的基础知识(只有5个小时),我编辑了答案。但就像其他人告诉你的一样-
elif
应该匹配另一个
if
子句的缩进。否则这是一个语法错误。还有没有更简单的方法来组织这个
File "<stdin>", line 63
    elif answerthree == "go to gas station":
       ^
SyntaxError: invalid syntax
print "hello, and welcome to your world!"
print "are you ready?"
while True:   
        answerone = raw_input("yes or no?").lower()
        if answerone == "yes" or answerone == "y":
            break
            print "well fantastic! your at a crossroads you can go left or right..."
        while True:    
            answertwo = raw_input("left or right?").lower()
            if answertwo == "left" or answertwo == "l":
                break
                print "you got hit by a car your dead"
                print "gameover"
            elif answertwo == "right" or answertwo == "r":
                break   
                print "you see a gas station"
                print "but you also she something shiny in the sand"
            while True:    
                answerthree = raw_input("grab the shiny object or go to the gas station?").lower()
                if answerthree == "grab shiny object":
                    break
                    print "you found a GUN!"
                    print" but it only has"
                    from random import randint
                    bullets = (randint(2,9))
                    print bullets
                print "bullets"
                while True:    
                    answerfive = raw_input("do you continue to the gas station or go to a nearby building to sleep? type either gas station or sleep")
                    if answerfive == "sleep":
                        break
                        print " you went to a nearby building to sleep."
                    elif answerfive == "gas station":
                        break
                        print "on your way to the gas station you encounter enemys inside the building"
                    print "there are"
                    enemys = (randint(2,9))
                    print enemys
                    print "of them"
                while True:    
                    answersix = raw_input("do you try to shoot them with your gun or flee to a nearby building? type either shoot or flee")
                    if answersix == "shoot":
                        break
                        print " you go to shoot them"
                        if enemys>7:
                            print "when you went to attack you were overpowered by their numbers and died"
                            print "game over"
                        elif enemys<7:
                            print "you went to attack them and emerged victorious!"
                            bullets = bullets-enemys
                            if bullets<0:
                                bullets = 0
                            print "you now only have"
                            print bullets
                            print "left"
                        else:
                            print "error"
                    elif answersix == "flee":
                        break
                        print " you flee to a nearby building where you sleep for the night"
                    else:
                        print "you diddnt type anything!"
                elif answerthree == "go to gas station":
                    break
                    print "on your way to the gas station you encounter enemys inside the building"
                    print "there are"
                    enemys = (randint(2,9))
                    print enemys
                    print "of them"
                while True    
                    answerfour = raw_input("do you try to fight them with your fists or flee to a nearby building?")
                    if answerfour == "fight them":
                        break
                        print " you go to attack them"
                        if enemys>3:
                            print "when you went to attack you were overpowered by their numbers and died"
                            print "game over"
                        elif enemys<3:
                            print "you went to attack them and emerged victorious!"
                        else:
                            print "error"
                    elif answerfour == "flee":
                        break
                        print " you flee to a nearby building where you sleep for the night"
                    else:
                        print "you diddnt type anything!"
                else:
                    print "you diddnt type anything!"
            else:
                print " you diddnt type anything!"
        elif answerone == "no" or answerone == "n":
            break   
            print "well this was a fun game wasnt it?"
        else:
            print "you diddnt type anything!"