Skip to content

Instantly share code, notes, and snippets.

@mfilipelino
Last active November 25, 2022 14:26
Show Gist options
  • Save mfilipelino/7c8e3b076f90e8c215a4a836c24c2856 to your computer and use it in GitHub Desktop.
Save mfilipelino/7c8e3b076f90e8c215a4a836c24c2856 to your computer and use it in GitHub Desktop.
is prime
def is_prime(number):
if number <= 0:
return False
if number == 1:
return True
elif number == 2:
return True
else:
for i in range(2, number):
if number % i == 0:
return False
return True
@rudrathegreat
Copy link

Is 1 a prime number, technically, because it is only divisible by itself and 1 (which is itself)?

@mfilipelino
Copy link
Author

Is 1 a prime number, technically, because it is only divisible by itself and 1 (which is itself)?

Ok, Thanks I'm correctly now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment