代码 # coding=utf-8 l=list() for n in range(100,501): a=0 for j in range(2,n): if(n%j==0): a=1 if(a==0): l.append(n) print(l)