Created
October 19, 2017 06:41
-
-
Save kaashmonee/0b17b9c1e400bdbb152ab76b2230c064 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#checks to see if n is prime in one line | |
def oneLineIsPrime(n): return False if (n % 2 == 0 and n > 2) or n < 2 or 0 in [n%factor for factor in range(3, round(n ** 0.5))] else True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment