Иванова Алина Алексеевна мм.Б42-25#20
Open
ialina07 wants to merge 7 commits intopython-course-matmex:mainfrom
Open
Иванова Алина Алексеевна мм.Б42-25#20ialina07 wants to merge 7 commits intopython-course-matmex:mainfrom
ialina07 wants to merge 7 commits intopython-course-matmex:mainfrom
Conversation
…ментных массивов - Изменено условие цикла с left < right на left <= right - Исправлена ошибка, из-за которой поиск в одноэлементных массивах выполнялся некорректно. для одноэлементного массива было left = 0, right = 0, 0 < 0 = False, из-за чего цикл не выполнялся ни разу и возвращалось -1 - Теперь корректно возвращает индекс 0 для одноэлементного массива - Поддерживает корректное поведение для пустых и многоэлементных массивов
- Изменен постоянный вес 10 на уменьшающийся (10-i) - Теперь реализована правильная схема взвешивания ISBN-10: цифра*10 + цифра*9 + ... + цифра*1
- Заменено неправильное вычисление контрольной суммы стандартным алгоритмом ISBN-10 - Была проверка (total + check_digit) % 11 == 0 (математически неверно) - Теперь корректно вычисляется: expected_check_digit = (11 - (total % 11)) % 11 - Возвращает значение True, если фактическая контрольная цифра совпадает с ожидаемым значением
- Добавлена проверка того, что ISBN должен содержать ровно 10 цифр (по стандарту) - Возвращает значение False при недопустимых значениях длины (слишком коротких или длинных)
- Пользователь вводит ISBN, получает correct/incorrect - Завершает работу при вводе -1 - Корректно обрабатывается пустой ввод и различные ошибки
Godrik0
reviewed
Dec 13, 2025
Godrik0
left a comment
There was a problem hiding this comment.
ISBN10: 7/10
Бинарный поиск: 4/5
Оформление: 6/10 (нет лицензии, README, .gitignore, описания к PR)
Comment on lines
-3
to
13
| digits = [int(char) for char in ISBNNumber if char.isdigit()] | ||
| digits = [int(char) for char in isbn_number if char.isdigit()] | ||
| if len(digits) != 10: | ||
| return False | ||
|
|
||
| checkDigit = digits[-1] | ||
| check_digit = digits[-1] | ||
|
|
||
| total = 0 | ||
| for i in range(len(digits) - 1): | ||
| weight = 10 | ||
| weight = 10 - i | ||
| digit = digits[i] | ||
| total += digit * weight |
There was a problem hiding this comment.
У Вас пропущена обработка символа X, который может служить контрольной цифрой.
| @@ -1,13 +1,32 @@ | |||
| from src.bin_search import binSearch | |||
| from src.bin_search import binary_search | |||
There was a problem hiding this comment.
В src.bin_search у Вас функция называется bin_search, тесты упадут.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Контрольная работа