Skip to content

Homework1#5

Open
vslyubimov wants to merge 6 commits into
masterfrom
homework1
Open

Homework1#5
vslyubimov wants to merge 6 commits into
masterfrom
homework1

Conversation

@vslyubimov

Copy link
Copy Markdown
Owner

No description provided.

Comment thread homework1/task02.py Outdated
a, b = b, a + b


def check_fibonacci(data: Sequence[int]) -> bool:

Copy link
Copy Markdown

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

Comment thread homework1/task03.py Outdated

def find_maximum_and_minimum(file_name: str) -> Tuple[int, int]:
max_value = 1
min_value = 1

Copy link
Copy Markdown

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

Comment thread homework1/task05.py Outdated
def find_maximal_subarray_sum(nums: List[int], k: int) -> int:
summ = 0
overall_sum = 0
current_sum = 0

Copy link
Copy Markdown

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) 

Comment thread tests/homework1/test_task02.py Outdated
check4 = []
check5 = [0, 1]
check6 = [55, 66]
check7 = [3, 5, 8, 13, 21, 34]

Copy link
Copy Markdown

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

Comment thread homework1/task03.py Outdated
Comment on lines +18 to +19
max_value = 0
min_value = 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

what about negative values?

Comment thread homework1/task05.py
from typing import List


def find_maximal_subarray_sum(nums: List[int], k: int) -> int:

Copy link
Copy Markdown

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants