Skip to content

Instantly share code, notes, and snippets.

@FrancoMuniz
Created April 7, 2019 03:08
Show Gist options
  • Save FrancoMuniz/a383dab373ce3d528c4a932f770e4676 to your computer and use it in GitHub Desktop.
Save FrancoMuniz/a383dab373ce3d528c4a932f770e4676 to your computer and use it in GitHub Desktop.
import math
def main():
while True:
print(isPrime(int(input('Enter a number to check if it is prime: '))))
def isPrime(n):
ans = [num for num in range(2,int(math.sqrt(n)+1)) if n % num == 0]
return not bool(ans)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment