Skip to content

Instantly share code, notes, and snippets.

@libert-xyz
Created January 7, 2016 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save libert-xyz/0c21bc0fb6b443635d83 to your computer and use it in GitHub Desktop.
Save libert-xyz/0c21bc0fb6b443635d83 to your computer and use it in GitHub Desktop.
##Libert R Schmidt
##rschmidt@libert.xyz
##http://www.practicepython.org/exercise/2014/04/16/11-check-primality-functions.html
def divisors(num):
c = 0
for i in range(1,num+1):
if num % i == 0:
c = c + 1
return c
def primes():
num = int(input("Enter a Number: "))
div = divisors(num)
if div == 2:
print ("Your Number is Prime")
else:
print ("Your Number isn't Prime")
primes()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment