-
Notifications
You must be signed in to change notification settings - Fork 260
everything but the bonus #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
krepysh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Повторяющиеся проблемы (is not None, _ как имя переменной) не в каждом месте отмечал, исправь везде пожалуйста.
for_challenges.py
Outdated
| 'Маша': False, | ||
| } | ||
| for name in is_male: | ||
| if is_male[name] == True: |
There was a problem hiding this comment.
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]:
for_challenges.py
Outdated
| ['Вася', 'Маша', 'Саша', 'Женя'], | ||
| ['Оля', 'Петя', 'Гриша'], | ||
| ] | ||
| print(f'Всего груп: {len(groups)}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
групп
for_dict_challenges.py
Outdated
| for student in students: | ||
| name = student['first_name'] | ||
| if names.get(name) == None: | ||
| names[name] = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут можно без if обойтись
| names[name] = 1 | |
| names[name] = names.get(name, 0) + 1 |
for_dict_challenges.py
Outdated
| for student in students: | ||
| name = student['first_name'] | ||
| if names.get(name) == None: | ||
| names[name] = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Здесь можно использовать решение предыдущей задачи, если обернуть его в функцию.
for_dict_challenges.py
Outdated
| for grade in school_students: | ||
| names = {} | ||
| for student in grade: | ||
| name = student['first_name'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Аналогично, можно использовать решение первой задачи тут.
for_dict_challenges_bonus.py
Outdated
| number_responses_per_user = {} | ||
| for _ in chat_history: | ||
| message_id = _['id'] | ||
| for i in number_answers: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is i?
for_dict_challenges_bonus.py
Outdated
| else: | ||
| number_responses_per_user[_['sent_by']] += number_answers[i] | ||
| most_cited = max(number_responses_per_user.values()) | ||
| for _ in number_responses_per_user: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
избавляемся от _
for_dict_challenges_bonus.py
Outdated
| message_id = _['id'] | ||
| for i in number_answers: | ||
| if i == message_id: | ||
| if number_responses_per_user.get(_['sent_by']) == None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если избавимся от if так же как раньше, код значительно упростится.
for_dict_challenges_bonus.py
Outdated
| who_saw = [] | ||
| message_list = user_messages[_] | ||
| for i in message_list: | ||
| for j in chat_history: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
что такое i, j? переименуй на что-то более понятное плиз
for_dict_challenges_bonus.py
Outdated
| by = _['id'] | ||
| beginning = _['reply_for'] | ||
| if answer == False: | ||
| while beginning != None and beginning != []: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is not None
любой не пустой словарь будет true, можно сделать
| while beginning != None and beginning != []: | |
| while beginning is not None and beginning: |
krepysh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
нужно поправить
… решения задач в функции для дальнейшего использования
No description provided.