Skip to content

Comments

Ашихмина Людмила Александровна Б42#9

Open
Lintari wants to merge 14 commits intopython-course-matmex:mainfrom
Lintari:main
Open

Ашихмина Людмила Александровна Б42#9
Lintari wants to merge 14 commits intopython-course-matmex:mainfrom
Lintari:main

Conversation

@Lintari
Copy link

@Lintari Lintari commented Nov 7, 2025

No description provided.

@Lintari
Copy link
Author

Lintari commented Nov 7, 2025

в конце несколько коммитов fixed some little problems Относились чисто к косметическим изменениям и там я просто строчку забыла убрать

Copy link

@Godrik0 Godrik0 left a comment

Choose a reason for hiding this comment

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

ISBN10: 5/10
Бинарный поиск: 4/5
Оформление: 5/10 (snake_case, нет лицензии, нет .gitignore, нет описания к PR)

@@ -1,6 +1,8 @@
def binSearch(xs: list[int], x: int):
if type(x) != int:
return "wrong type"
Copy link

Choose a reason for hiding this comment

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

Нужно бросать исключение. Такой return может быть неожиданным для пользователя, потому что он ожидает, что возвращаемым значением будет число, а возвращается строка.

Comment on lines +9 to +14
elif char != '-' and char != ' ':
return False


if len(digits) != 10:
return False
Copy link

Choose a reason for hiding this comment

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

Рекомендация: при неверной длине строки (или других ошибках) лучше выбрасывать исключение, чтобы различать некорректный формат входных данных и просто невалидную контрольную сумму.
Тогда в вызывающем коде нужно будет добавить блок try-except.


def test_good():
assert modulo11Checksum("2-266-11156-3")
assert modulo11Checksum("1-563-68745-X")
Copy link

Choose a reason for hiding this comment

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

Image

Copy link

Choose a reason for hiding this comment

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

В задании требовалось также реализовать консольную утилиту.

Copy link

Choose a reason for hiding this comment

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

Не хватает тестов на пустой массив, на массив из 1 элемента.

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