Skip to content

Instantly share code, notes, and snippets.

@libert-xyz
Created January 7, 2016 20:13
Show Gist options
  • 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
##[email protected]
##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