Skip to content

Comments

Стариков Егор, 142 гр#7

Open
EStarikov wants to merge 10 commits intopython-course-matmex:mainfrom
EStarikov:control_work
Open

Стариков Егор, 142 гр#7
EStarikov wants to merge 10 commits intopython-course-matmex:mainfrom
EStarikov:control_work

Conversation

@EStarikov
Copy link

No description provided.

@EStarikov EStarikov changed the title Control work Стариков Егор, 142 гр Nov 10, 2025
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: 6/10
Бинарный поиск: 2/5
Оформление: 6/10 (нет лицензии, нет .gitignore, нет описания PR)

Comment on lines +3 to +5
for i in range(len(xs) - 1):
if xs[i] > xs[i + 1]:
return -1
Copy link

Choose a reason for hiding this comment

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

Бинарный поиск должен работать за $O(\log{N})$, добавляя цикл с проверкой на сортировку он начинает работать за $O(N)$.

Comment on lines +25 to +35
print("Введите номер:")
s = input()
while True:
if modulo11checksum(s):
print("Все верно")
elif s == "-1":
break
else:
print("Что-то не так")
print("Введите номер:")
s = input()
Copy link

Choose a reason for hiding this comment

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

Когда pytest импортирует этот файл для тестов, он зависнет, ожидая ввода данных.
Код, который относится к запуску нужно оборачивать в if __name__ == "__main__".

digits = [int(char) for char in isbn_number if char.isdigit()]

checkDigit = digits[-1]
if len(digits) < 9:
Copy link

Choose a reason for hiding this comment

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

Для ISBN-10 (с учетом X) должно быть ровно 9 или 10 цифр. Сейчас мы можем ввести 1-2-3-4-5 и программа упадет в цикле for i in range(9). Либо вообще ввести "" и всё упадет уже на last_char = isbn_number[-1].

assert binSearch([1, 2, 3, 4, 5], 4) == 3
assert bin_search([1, 2, 3, 4, 5], 3) == 2

def not_sorted_list():
Copy link

Choose a reason for hiding this comment

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

pytest по умолчанию ищет функции, начинающиеся с test_. Функция not_sorted_list не будет запущена.

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