Skip to content

everything but the bonus - #21

Open
mxlZUBENKO wants to merge 3 commits into
learnpythonru:mainfrom
mxlZUBENKO:main
Open

everything but the bonus#21
mxlZUBENKO wants to merge 3 commits into
learnpythonru:mainfrom
mxlZUBENKO:main

Conversation

@mxlZUBENKO

Copy link
Copy Markdown

No description provided.

@krepyshkrepysh left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Comment threadfor_challenges.py Outdated
'Маша': False,
}
for name in is_male:
if is_male[name] == True:

Copy link
Copy Markdown

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]:

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

групп

Comment threadfor_dict_challenges.py Outdated
for student in students:
name = student['first_name']
if names.get(name) == None:
names[name] = 1

Copy link
Copy Markdown

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

Comment threadfor_dict_challenges.py Outdated
for student in students:
name = student['first_name']
if names.get(name) == None:
names[name] = 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Comment threadfor_dict_challenges.py Outdated
for grade in school_students:
names = {}
for student in grade:
name = student['first_name']

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Comment threadfor_dict_challenges_bonus.py Outdated
number_responses_per_user = {}
for _ in chat_history:
message_id = _['id']
for i in number_answers:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

what is i?

Comment threadfor_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:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Comment threadfor_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:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Comment threadfor_dict_challenges_bonus.py Outdated
who_saw = []
message_list = user_messages[_]
for i in message_list:
for j in chat_history:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Comment threadfor_dict_challenges_bonus.py Outdated
by = _['id']
beginning = _['reply_for']
if answer == False:
while beginning != None and beginning != []:

Copy link
Copy Markdown

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
whilebeginning!=Noneandbeginning!= []:
whilebeginningisnotNoneandbeginning:

@krepyshkrepysh left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

нужно поправить

… решения задач в функции для дальнейшего использования
Sign up for freeto 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

@mxlZUBENKO@krepysh