BC81 KiKi求质数个数

思路:

step1:先筛选出合数;然后选出质数,打印列表长度即可;

代码如下:

c = []
for i in range(100,1000):
    for j in range(2,int(i**0.5)+1):
        if i%j == 0:
            c.append(i)
            break
b = []
for i in range(100,1000):
    if i not in c:
        b.append(i)
print(len(b))