IndentationError:预期缩进块13

时间:2013-10-27 17:20:28

标签: python

这是我的代码

def count (a, e, i, o, u):
    a_length = len(a);
    e_length = len (e);
    i_length = len (i);
    o_length = len (o);
    u_length = len (u);

    total = 0;
    for i in range (a_lenght):
        if(a[i] == u[0]):
        end = i + u_length;

        if (a[i:end] == u):
        total +=1;

这是错误

错误隐藏输出

•  File "submission.py", line 11
    end = i + u_length;
  ^
IndentationError: expected an indented block

1 个答案:

答案 0 :(得分:4)

你必须在python中为if块添加缩进。

total = 0;
for i in range (a_lenght):
    if(a[i] == u[0]):
        end = i + u_length;

    if (a[i:end] == u):
        total +=1;