Skip to content

Commit

Permalink
main update
Browse files Browse the repository at this point in the history
Update on main script
  • Loading branch information
erickofs committed Dec 12, 2023
1 parent 5f41140 commit 8ad0702
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions desafio-02/erickofs/python/__main__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
A simple program to print all prime numbers up to a given number with nth range.
"""
from soecalc import sieve_of_eratosthenes_set
from soecalc import PrimeCalc

if __name__ == "__main__":
for prime in sieve_of_eratosthenes_set():
for prime in PrimeCalc.sieve_of_eratosthenes_set():
print(prime)
4 changes: 1 addition & 3 deletions desafio-02/erickofs/python/soecalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ class PrimeCalc:
def sieve_of_eratosthenes_set():
"""
Implements the Sieve of Eratosthenes to find all prime numbers up to the given limit.
Returns:
- primelist (set): Set of prime numbers up to the user's nth given range.
"""
Expand All @@ -25,8 +24,7 @@ def sieve_of_eratosthenes_set():
primelimit = 100.0
print("No given limit. It has been automatically set to 100.")
break
print("Invalid input. Please enter a valid number.")

print("Invalid input. Please enter a valid number.")
if round(primelimit) != primelimit:
print(f"The limit has been rounded to the nearest integer: {round(primelimit)}")
primelimit = int(round(primelimit))
Expand Down

0 comments on commit 8ad0702

Please sign in to comment.