Created
April 18, 2016 20:03
-
-
Save chrisy/0e77f8464a30638618cdae8fcf943a5e to your computer and use it in GitHub Desktop.
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
def defined_range(user_input): | |
if 1 <= user_input <= 10000: | |
return True | |
else: | |
return False | |
print "Please give me a number between 1 and 10000 to find if it is prime " | |
while True: | |
user_input = int(raw_input('Please input your number ')) | |
if defined_range(user_input) == True: | |
div = user_input - 1 | |
result = True | |
while(div > 1): | |
if user_input % div == 0: | |
print "This number is divisible by " + str(div) | |
result = False | |
div = div - 1 | |
if result == False: | |
print "This is not prime" | |
if result == True: | |
print "This is a prime" | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment