【Python】【求100以内的质数】

求100以内的质数,提示:质数仅能被1和自己整除的数

list1=[]
for j in range(2,101):
    for i in range(2, j):
        if j%i==0:
            #print('%s不是质数'%number)
            break
        else:
            list1.append(j)
print(list1)

猜你喜欢

转载自blog.csdn.net/qq_59642714/article/details/125009927