Skip to content

Instantly share code, notes, and snippets.

@lucasbazan
Last active January 31, 2022 17:26
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 lucasbazan/9a3c45c81ede877aa0bb3b3431c55532 to your computer and use it in GitHub Desktop.
Save lucasbazan/9a3c45c81ede877aa0bb3b3431c55532 to your computer and use it in GitHub Desktop.
This function check if a number is prime or not.
def is_prime(num):
mult = [i for i in range(1, num+1) if num % i == 0]
if len(mult) == 2 and 1 in mult and num in mult:
return True
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment