求素数python

#求素数
def get_prime(n):
    if n == 1:
        return False
    for i in range(2,n):
        if n % i == 0:
            return False
    return True
def get_prime_list(n):
    prime_list = []
    for i in range(1,n+1):
        if get_prime(i):
            prime_list.append(i)
    return prime_list
#求素数的个数
def get_prime_num(n):
    count = 0
    for i in range(1,n+1):
        if get_prime(i):
            count += 1
    return count
print(get_prime_num(100))
print(get_prime_list(100))

[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]