Skip to content

Feature - verify and test #182

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
14 changes: 14 additions & 0 deletions src/verify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def is_num_present(num_to_check: int | float, list_of_num) -> bool:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

potresti tipizzare list_of_num definendolo list di interi con list_of_num : List[int] oppure con list_of_num : list[int] se usi python 3.10

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

o magari list[float|int]

return num_to_check in list_of_num

def print_check(check: int | float, list_present) -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stessa cosa qui

if is_num_present(check, list_present):
print("The number is present")
else:
print("The number is not present")

if __name__ == "__main__":
num_present = [1.00, 90.00, 14.00, 18.25, 19.15, 89.00]
print_check(14, num_present)
print_check(25, num_present)
print_check(89, num_present)
8 changes: 8 additions & 0 deletions tests/test_verify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from src.verify import is_num_present

def test_is_num_present() -> None:
list_num_present = [1.00, 90.00, 14.00, 18.25, 19.15, 89.00]
assert is_num_present(1, list_num_present)
assert not is_num_present(60, list_num_present)
assert is_num_present(90, list_num_present)
assert not is_num_present(1300, list_num_present)