Skip to content

Comments

Тупикова Екатерина Викторовна, Б42#16

Open
sugahu565 wants to merge 16 commits intopython-course-matmex:mainfrom
sugahu565:main
Open

Тупикова Екатерина Викторовна, Б42#16
sugahu565 wants to merge 16 commits intopython-course-matmex:mainfrom
sugahu565:main

Conversation

@sugahu565
Copy link

No description provided.

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: 8/10
Бинарный поиск: 4/5
Оформление: 8/10 (snake_case, .gitignore)

def bin_search(xs: list[int], x: int):

if type(x) != int:
raise "x is not int"
Copy link

Choose a reason for hiding this comment

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

В Python 3.x мы уже не можем кидать строки как исключения.

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

checkDigit = digits[-1]
assert (len(digits) == 9 and ISBNNumber[-1] == "X") or len(digits) == 10, "invalid lenght"
Copy link

Choose a reason for hiding this comment

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

Валидация на assert это плохо, он предназначен для отладки, и при запуске с флагом -O все ассерты вырезаются.

Copy link

Choose a reason for hiding this comment

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

Хотелось бы еще тесты с X

@@ -1,14 +1,38 @@
def modulo11Checksum(ISBNNumber: str):
Copy link

Choose a reason for hiding this comment

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

Почему-то тут не поменяли на snake_case.


left, right = 0, len(xs) - 1
while left < right:
while left <= right:
Copy link

Choose a reason for hiding this comment

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

Нет теста на этот случай.

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