Generation

generate functionSat, 12 Nov 2022

a function that returns all prime numbers

def prime_numbers(n): for i in range(2, n): is_prime = True j = 2 while j < i: if i% j == 0: is_prime = False j += 1 if is_prime: print(i)

Questions about programming?Chat with your personal AI assistant