[英]list index out of range error in python , why does it happen?
''' Read input from STDIN. ''' 从 STDIN 读取输入。 Print your output to STDOUT ''' #Use input() to read input from STDIN and use print to write your output to STDOUT将 output 打印到 STDOUT ''' #Use input() 从 STDIN 读取输入并使用 print 将 output 写入 STDOUT
def main():定义主要():
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)
main()主要的()
This will probably will not through that error这可能不会通过那个错误
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.