Restructure everything

This commit is contained in:
Kiana Sheibani 2024-07-28 06:01:20 -04:00
parent 81ca8af870
commit a8a26921b4
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
19 changed files with 227 additions and 67 deletions

View file

@ -0,0 +1 @@
from .main import *

View file

@ -0,0 +1,26 @@
def sieve_of_eratosthenes(n):
nums = list(range(2, n))
while nums:
prime = nums[0]
nums = [i for i in nums if i % prime]
yield prime
def main():
num = 0
another = True
while another:
try:
num = int(input("Primes up to: "))
another = False
except ValueError:
pass
print()
for i in sieve_of_eratosthenes(num):
print(i)
if __name__ == "__main__":
main()