Skip to content

Переписывание контрольной работы Бывалкина Мария - #8

Open
MariiaByvalkina wants to merge 4 commits into
mainfrom
test_rewrite
Open

Переписывание контрольной работы Бывалкина Мария#8
MariiaByvalkina wants to merge 4 commits into
mainfrom
test_rewrite

Conversation

@MariiaByvalkina

Copy link
Copy Markdown
Owner

No description provided.

Comment thread src/walker.py
if prob < 0:
raise ValueError

probability.append(data[i][1])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Почему не probability.append(prob)?

Comment thread src/walker.py
Comment on lines +25 to +26
if total < 1:
raise ValueError

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Тут другое условие. Сумма должна прямо быть равна 1

Comment thread src/walker.py
Comment on lines +36 to +37
donor = [i for i in range(n) if probability[i] < 1 / n]
recepient = [i for i in range(n) if probability[i] > 1 / n]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Круто! Очень по делу заиспользовали list comprehension

Comment thread src/walker.py
Comment on lines +48 to +49
donor = donor.pop()
recepient = recepient.pop()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

А вот это крайне не очевидный код. У вас donor -- это список, а тут вы эту переменную локально переопределяете. Не надо так, это сильно усложняет код

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