Skip to content

Instantly share code, notes, and snippets.

@srhopkins
Last active August 29, 2015 14:18
Show Gist options
  • Save srhopkins/e73d6cb5e98bb38c8e58 to your computer and use it in GitHub Desktop.
Save srhopkins/e73d6cb5e98bb38c8e58 to your computer and use it in GitHub Desktop.
Is number prime?
# I often need a simple method to determine prime numbers. Returns True or False.
is_prime = lambda num: all((num % i > 0 for i in xrange(2,num)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment