2013-10-27 118 views
0

這裏是我的代碼IndentationError:預計縮進塊13

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 
+0

對於其中一個,'if:'應該跟着更多的縮進行。你在這裏沒有差別。 –

回答

4

您必須添加縮進如果蟒蛇塊。

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

    if (a[i:end] == u): 
     total +=1; 
相關問題