关于#python#的问题,请各位专家解答!

img

img


不知道哪里有问题,求指教。


import re
j=0
temp=input('请输入:’)
result=re.split("#/-",temp)
for i in range(18):
print(result[j],result[j+1],result[j+2])j=j+3
j=2
tempe=0
for i in range(6):
tempe=tempe+result[j]
j=j+3
tempe=tempe/6
print(tempe)

img

结合你的循环,和你的取值结果,你需要18*3个数据片段,明显你输入的不够,range范围改成6

print(result[j],result[j+1],result[j+2])j=j+3
这里下标越界,你怎么输入的