Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
15 changes: 12 additions & 3 deletions src/arithmetic/arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from __future__ import annotations

import math


def add_numbers(a: int, b: int) -> int:
"""Return the sum of two integers.
Expand All @@ -13,7 +15,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:
Expand All @@ -28,7 +30,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:
Expand All @@ -43,4 +47,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