diff --git a/prime/list_of_prime.py b/prime/list_of_prime.py new file mode 100644 index 00000000..5095abe7 --- /dev/null +++ b/prime/list_of_prime.py @@ -0,0 +1,12 @@ +number = int(input("Input a number to generate a list of prime numbers smaller itself: ")) + +def is_prime(num): + for i in range(2, num): + if num % i == 0: + return False + return True + +for i in range(2, number+1): + if is_prime(i): + print(i) + \ No newline at end of file