Skip to content

Instantly share code, notes, and snippets.

@naemazam
Created October 20, 2021 09:57
Show Gist options
  • Save naemazam/50047bb9812a07fe1a8579290878eee0 to your computer and use it in GitHub Desktop.
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
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