0

这是我的代码

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
4

1 回答 1

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;
于 2013-10-27T17:21:17.703 回答