Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/362.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 蟒蛇:为什么我会得到一个";应为缩进块“;关于elif(r<;=9):_Python_If Statement - Fatal编程技术网

Python 蟒蛇:为什么我会得到一个";应为缩进块“;关于elif(r<;=9):

Python 蟒蛇:为什么我会得到一个";应为缩进块“;关于elif(r<;=9):,python,if-statement,Python,If Statement,我似乎不知道我在哪里错误地格式化了这段python代码。我已经确定缩进是正确的,但我不知道为什么会发生这种错误。我错过了什么 width = passageWidth(checkChamber, chamberMaxLength) if (width >= 10): point = width/2 else: width = 2 r = random.randint(1, 19) #think aboout adding stairs later!!! if (r <

我似乎不知道我在哪里错误地格式化了这段python代码。我已经确定缩进是正确的,但我不知道为什么会发生这种错误。我错过了什么

width = passageWidth(checkChamber, chamberMaxLength)
if (width >= 10):
    point = width/2
else:
    width = 2
r = random.randint(1, 19) #think aboout adding stairs later!!!
if (r <= 14):
    if (r == 5):
        door(False, 0) #continue 20, end door
    elif (r == 10):
        x = random.randint(1, 10)
        if (x == 1):
            door(False, -1) #continue 20, secret door
        else:
            #continue 20, dead end
    elif (r <= 9): ########### Error occurs here ##############
        if (r <= 6):
            if (r <= 2):
                #continue 30
            elif (r == 3):
                door(False, 0) #continue 30, door right at 20
            elif (r == 4):
                door(False, 0) #continue 30, door left at 20
            else:
        elif (r >= 6):
            if (r >= 8):
                passage(False, 0) #continue 30, passage left at 20
            else:
                passage(False, 0) #continue 30, passage right at 20
        else:
    elif (r <= 12):
        #continue 20 plus point, turn left, continue 10 plus point
    else:
        #continue 20 plus point, turn right, continue 10 plus point

    #offset edges along passage by point value to define sides of passage
elif (r <= 19):
    #create Chamber
else:
    #stairs

#Check if space is available, if not, terminate!
width=passageWidth(检查室、房间长度)
如果(宽度>=10):
点=宽度/2
其他:
宽度=2
r=random.randint(1,19)#考虑一下稍后添加楼梯!!!
如果(r
else):
#继续20,死胡同

elif(r)上面的
else
子句中没有任何内容。您需要一些内容。如果您不想对其进行编码,请使用
pass
将其添加到@MooingRawr答案中。其他所有“elif”、“else”也一样那是空的。好的,谢谢。我不知道pass。还可能想指出其他注释掉的块。如果它是空的,可能可以删除
else
    else:
        #continue 20, dead end
elif (r <= 9):########### Error occurs here ##############
    else:
        pass # continue 20, dead end
elif (r <= 9):
elif r <= 9: