求素数和作业

def get_su_num(start,end):

    a = []

    end = end + 1

    for n in range(start,end):

        count = 0

        for m in range(1,n):

            if n%m == 0:

                count = count + 1

        if count <= 1 and n != 1:

            a.append(n)

    return a

print(sum(get_su_num(1,100)))

你可能感兴趣的:(求素数和作业)