From dab4ba52e6908fffdbe0da7ff6486bceaa593da5 Mon Sep 17 00:00:00 2001 From: Victor Guo Date: Sun, 14 Sep 2025 22:50:35 -0500 Subject: [PATCH 1/3] passed all tests --- src/arithmetic/arithmetic.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/arithmetic/arithmetic.py b/src/arithmetic/arithmetic.py index 86f6960..4c9320e 100644 --- a/src/arithmetic/arithmetic.py +++ b/src/arithmetic/arithmetic.py @@ -1,6 +1,6 @@ """arithmetic functions.""" - from __future__ import annotations +import math def add_numbers(a: int, b: int) -> int: @@ -13,7 +13,7 @@ def add_numbers(a: int, b: int) -> int: Returns: Sum of a and b. """ - raise NotImplementedError + return a + b def factorial(n: int) -> int: @@ -28,7 +28,9 @@ def factorial(n: int) -> int: Raises: ValueError: if n is negative """ - raise NotImplementedError + if n < 0: + raise ValueError() + return math.factorial(n) def is_prime(n: int) -> bool: @@ -43,4 +45,9 @@ def is_prime(n: int) -> bool: Returns: True if n is prime; otherwise False. """ - raise NotImplementedError + if n <= 1: + return False + for i in range(2, int(math.sqrt(n))+1): + if n % i == 0: + return False + return True From fb90b81c577ceac7f68ec12d9a021ca83949616d Mon Sep 17 00:00:00 2001 From: Victor Guo Date: Sun, 14 Sep 2025 22:52:31 -0500 Subject: [PATCH 2/3] modified readme --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index af2eb1b..74aee94 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,9 @@ 1. Fork this repository to your own GitHub account. 2. Create a new branch from `develop` and name it `feature/student1name_student2name`. 3. Clone the repo to AWS VM. -4. Implement the functions until all `pytest` tests pass. -5. Push your code to your Github repo. -5. Submit a Pull Request back to the `develop` branch of the main repo. CI must pass. -6. Wait for code review and grading. +4. Run poetry install to install dependencies. +5. Run poetry run pre-commit install to install the pre-commit hook. +6. Implement the functions until all `pytest` tests pass. Commit and pass pre-commit checks. +7. Push your code to your Github repo. +8. Submit a Pull Request back to the `develop` branch of the main repo. CI must pass. +9. Wait for code review and grading. From c6110c5152f9528355e7dfa6ad238fa880404978 Mon Sep 17 00:00:00 2001 From: Victor Guo Date: Sun, 14 Sep 2025 23:10:11 -0500 Subject: [PATCH 3/3] formatted file --- src/arithmetic/arithmetic.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/arithmetic/arithmetic.py b/src/arithmetic/arithmetic.py index 4c9320e..e150edd 100644 --- a/src/arithmetic/arithmetic.py +++ b/src/arithmetic/arithmetic.py @@ -1,5 +1,7 @@ """arithmetic functions.""" + from __future__ import annotations + import math @@ -47,7 +49,7 @@ def is_prime(n: int) -> bool: """ if n <= 1: return False - for i in range(2, int(math.sqrt(n))+1): + for i in range(2, int(math.sqrt(n)) + 1): if n % i == 0: return False return True