Created
May 7, 2019 20:16
-
-
Save frogandcode/1cb74109b2ab309bf44d50470e42e3ee to your computer and use it in GitHub Desktop.
Primes under 100
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
| print("Prime numbers under 100:") | |
| def is_prime(number): | |
| divisor = 2 # Start with most likely factor and increment | |
| while divisor <= (number / 2): | |
| if ((number % divisor) == 0): return False | |
| divisor += 1 | |
| return True | |
| for number in range(2, 100): | |
| if is_prime(number): print(number) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: