-
Notifications
You must be signed in to change notification settings - Fork 0
Homework1 #5
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
base: master
Are you sure you want to change the base?
Homework1 #5
Conversation
homework1/task02.py
Outdated
| a, b = b, a + b | ||
|
|
||
|
|
||
| def check_fibonacci(data: Sequence[int]) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You dont need to generate a new sequence for check
homework1/task03.py
Outdated
|
|
||
| def find_maximum_and_minimum(file_name: str) -> Tuple[int, int]: | ||
| max_value = 1 | ||
| min_value = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File can contains only "1", so you cant return "1" as max and min values
homework1/task05.py
Outdated
| def find_maximal_subarray_sum(nums: List[int], k: int) -> int: | ||
| summ = 0 | ||
| overall_sum = 0 | ||
| current_sum = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test your function with that data
find_maximal_subarray_sum([1, 4, 7, -10, 6, 1, 1], 3)
tests/homework1/test_task02.py
Outdated
| check4 = [] | ||
| check5 = [0, 1] | ||
| check6 = [55, 66] | ||
| check7 = [3, 5, 8, 13, 21, 34] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add these params into functions or use pytest's parametrize
homework1/task03.py
Outdated
| max_value = 0 | ||
| min_value = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about negative values?
| from typing import List | ||
|
|
||
|
|
||
| def find_maximal_subarray_sum(nums: List[int], k: int) -> int: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test with find_maximal_subarray_sum([1, 3, -1, -3, 5, -3, 6, 7], 3)
No description provided.