Created
October 20, 2021 09:57
-
-
Save naemazam/50047bb9812a07fe1a8579290878eee0 to your computer and use it in GitHub Desktop.
input a natural number greater than 2, and then output a list of all prime numbers less than that number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n=int(input("Enter natural number greater then 2: ")) | |
primes = [] | |
for i in range (2, n): | |
for j in range(2, i): | |
if i%j == 0: | |
break | |
else: | |
primes.append(i) | |
print(primes) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment