Skip to content

Created problem_46 in project_euler #2343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 21, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion project_euler/problem_46/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,23 @@ def compute_nums(n: int) -> List[int]:
[5777]
>>> compute_nums(2)
[5777, 5993]
>>> compute_nums(0)
Traceback (most recent call last):
...
ValueError: n must be => 0
>>> compute_nums("a")
Traceback (most recent call last):
...
ValueError: n must be an exact integer
>>> compute_nums(1.1)
Traceback (most recent call last):
...
ValueError: n must be an exact integer
"""
if not isinstance(n, int):
raise ValueError("n must be an exact integer")
if n <= 0:
raise ValueError("n must be => 0")
list_nums = []
for num in range(len(odd_composites)):
i = 0
Expand All @@ -67,4 +83,4 @@ def compute_nums(n: int) -> List[int]:


if __name__ == "__main__":
print(f"{compute_nums(2) = }")
print(f"{compute_nums(1) = }")