primes numbers finder | Python

March 11th, 2021 01:33:58 PM

					
prime_lists=[] # a list to store the prime numbers def prime(n): # define prime numbers if n <= 1: return False # divide n by 2... up to n-1 for i in range(2, n): if n % i == 0: # the remainder should'nt be a 0 return False else: prime_lists.append(n) return True for n in range(30,1000): # calling function and passing starting point =30 coz we need primes >30 prime(n) check=0 # a var to limit the output to 10 only for n in prime_lists: for x in prime_lists: val= n *x if (val > 1000 ): check=check +1 if (check <10) : print("the num is:", val , "=",n , "* ", x ) break

Featured Posts