Created
June 12, 2018 09:59
-
-
Save kenessajr/a8ded99030685e31e205e07288b30cc7 to your computer and use it in GitHub Desktop.
Return all prime number in a given range
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
""" function to return if it's a prime number """ | |
def is_prime(n): | |
for i in range(3, n): | |
if n % i == 0: | |
return False | |
return True | |
n_range = int(input('Enter your range ')) | |
for n in range(2, n_range): | |
if is_prime(n): | |
print n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment