maynul67

all prime numbers within a range

Jul 13th, 2021
751
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def is_prime(num):
  2.     for i in range(2,num):
  3.         if (num % i) == 0:
  4.             return False
  5.     return True
  6.  
  7. def all_prime(n):
  8.     list = []
  9.     for a in range(2,n):
  10.         if is_prime(a) == True:
  11.             list.append(a)
  12.     return list
  13.    
  14. n= int(input("enter number: "))
  15. b = all_prime(n)
  16. print(b)
RAW Paste Data