python 3 我的代码提交显示Traceback (most recent call last): File "a.py3", line 25, in print(list[a-1],end='') IndexError: list index out of range,可是我没看出有越界啊……大佬们帮我看看
a,b=map(int,input().split())
list=[]
first=2
while first<=10000:
flag=True
k=2
while k<=first**0.5:
if first%k==0:
flag=False
break
k+=1
if flag:
list.append(first)
if len(list)==b:
break
first+=1
i=1
while a<=b:
if a!=b:
if i%10!=0:
print(list[a-1],end=' ')
else :
print(list[a-1])
else :
print(list[a-1],end='') # 这一行报错
i+=1
a+=1