Last active
May 20, 2019 07:49
-
-
Save flamanta/08a8b7bcad3a8d0bd9cb1e37ee32574a to your computer and use it in GitHub Desktop.
[Check if prime] #math
This file contains hidden or 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
| def is_prime(n): | |
| if n < 2: | |
| return False | |
| if n == 2: | |
| return True | |
| for num in range(3, int(n**0.5)+1, 2): | |
| if n % num == 0: | |
| return False | |
| return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment