Skip to content

Instantly share code, notes, and snippets.

@eserdinyo
Last active May 29, 2018 21:46
Show Gist options
  • Save eserdinyo/ef6e9807699c69075febe3ea2737740b to your computer and use it in GitHub Desktop.
Save eserdinyo/ef6e9807699c69075febe3ea2737740b to your computer and use it in GitHub Desktop.
Is it Prime with Py
enterNum = 1
counter = 0
nubmerOfPrime = 0
def isPrime(num):
global counter
if num > 1:
for i in range(2, num):
if num % i == 0:
return 1
counter += 1
return counter
while (enterNum != 0):
enterNum = int(input("enter num: "))
nubmerOfPrime = isPrime(enterNum)
print("number of primes: ",nubmerOfPrime)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment