Skip to content

Conversation

@mxlZUBENKO
Copy link

No description provided.

Copy link

@krepysh krepysh left a comment

Choose a reason for hiding this comment

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

Повторяющиеся проблемы (is not None, _ как имя переменной) не в каждом месте отмечал, исправь везде пожалуйста.

'Маша': False,
}
for name in is_male:
if is_male[name] == True:
Copy link

Choose a reason for hiding this comment

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

Лучше не сравнивать с True, просто if is_male[name]:

['Вася', 'Маша', 'Саша', 'Женя'],
['Оля', 'Петя', 'Гриша'],
]
print(f'Всего груп: {len(groups)}')
Copy link

Choose a reason for hiding this comment

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

групп

for student in students:
name = student['first_name']
if names.get(name) == None:
names[name] = 1
Copy link

Choose a reason for hiding this comment

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

Тут можно без if обойтись

Suggested change
names[name] = 1
names[name] = names.get(name, 0) + 1

for student in students:
name = student['first_name']
if names.get(name) == None:
names[name] = 1
Copy link

Choose a reason for hiding this comment

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

Здесь можно использовать решение предыдущей задачи, если обернуть его в функцию.

for grade in school_students:
names = {}
for student in grade:
name = student['first_name']
Copy link

Choose a reason for hiding this comment

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

Аналогично, можно использовать решение первой задачи тут.

number_responses_per_user = {}
for _ in chat_history:
message_id = _['id']
for i in number_answers:
Copy link

Choose a reason for hiding this comment

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

what is i?

else:
number_responses_per_user[_['sent_by']] += number_answers[i]
most_cited = max(number_responses_per_user.values())
for _ in number_responses_per_user:
Copy link

Choose a reason for hiding this comment

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

избавляемся от _

message_id = _['id']
for i in number_answers:
if i == message_id:
if number_responses_per_user.get(_['sent_by']) == None:
Copy link

Choose a reason for hiding this comment

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

Если избавимся от if так же как раньше, код значительно упростится.

who_saw = []
message_list = user_messages[_]
for i in message_list:
for j in chat_history:
Copy link

Choose a reason for hiding this comment

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

что такое i, j? переименуй на что-то более понятное плиз

by = _['id']
beginning = _['reply_for']
if answer == False:
while beginning != None and beginning != []:
Copy link

Choose a reason for hiding this comment

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

is not None
любой не пустой словарь будет true, можно сделать

Suggested change
while beginning != None and beginning != []:
while beginning is not None and beginning:

Copy link

@krepysh krepysh left a comment

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