python_输出100:200内的素数

sushu=[]
for i in range(100,201):
    for j in range(2,i):
        if i%j==0:
            break
    if i==j+1:
        sushu.append(i)
print(sushu)

# 结果:[101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199]

 

  

posted @ 2018-01-06 20:48  耐烦不急  阅读(19598)  评论(0编辑  收藏  举报