Skip to content

Instantly share code, notes, and snippets.

@cnDelbert
Created October 15, 2014 05:52
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 cnDelbert/b85734b82604d28970fe to your computer and use it in GitHub Desktop.
Save cnDelbert/b85734b82604d28970fe to your computer and use it in GitHub Desktop.
Return True if n is a prime number otherwise return False
def is_prime(n):
'Return True if n is a prime number otherwise return False'
if n == 0 or n == 1:
return False
else:
for i in range(2, n):
if n%i == 0:
return False
return True
if __name__ == '__main__':
is_prime(n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment