[英]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.