Skip to content

Instantly share code, notes, and snippets.

@savolla
Created August 20, 2017 10:56
Show Gist options
  • Save savolla/c11843ff45594696c39ab0187e239bdc to your computer and use it in GitHub Desktop.
Save savolla/c11843ff45594696c39ab0187e239bdc to your computer and use it in GitHub Desktop.
Takes an integer and checks if its a prime number.
array = []
number = int(input())
for i in range(1,(number+1)):
modulo = (number % i)
if (modulo == 0):
array.append(modulo)
elif (len(array) > 2):
break
else:
continue
if (len(array) == 2):
print(number, "is prime <3 <3 <3")
else:
print("NOPE..", number, "is not prime.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment