[英]Why does a function return the error “list index out of range” in Python?
[英]list index out of range error in python , why does it happen?
''' 從 STDIN 讀取輸入。 將 output 打印到 STDOUT ''' #Use input() 從 STDIN 讀取輸入並使用 print 將 output 寫入 STDOUT
定義主要():
t = int(input())
strr =[]
vcount =0
ccount =0
for i in range(t):
s = input()
strr[i].append(s)
for i in strr:
for j in i:
if j == 'a' or 'e' or 'i' or 'o' or 'u':
vcount += 1
else:
ccount +=1
print(vcount,ccount,vcount*ccount)
主要的()
這可能不會通過那個錯誤
t = int(input())
strr =[]
vcount =0
ccount =0
for i in range(t):
s = input()
strr.append(s)
for i in strr:
for j in i:
if j == 'a' or 'e' or 'i' or 'o' or 'u':
vcount += 1
else:
ccount +=1
print(vcount,ccount,vcount*ccount)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.