-
Notifications
You must be signed in to change notification settings - Fork 0
For challenges #1
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
| names = ['Оля', 'Петя', 'Вася', 'Маша'] | ||
| # ??? | ||
| for name1 in names: | ||
| print(name1) |
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.
👍
| names = ['Оля', 'Петя', 'Вася', 'Маша'] | ||
| # ??? | ||
|
|
||
| for name3 in names: |
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.
💡 можно не менять названия переменным и использовать тот же name
| names = ['Оля', 'Петя', 'Вася', 'Маша'] | ||
| # ??? | ||
| for name in names: | ||
| if is_male[name] == False: |
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.
💡 еще можешь использовать тернарный оператор:
gender = 'мужской' if is_male[name] else 'женский'| ['Оля', 'Петя', 'Гриша'], | ||
| ] | ||
| # ??? | ||
| for group in range(1,len(groups)+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 idx, group in enumerate(groups, start=1):| ] | ||
| # ??? | ||
| for name in range(len(groups)): | ||
| names = ', '.join(groups[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.
👍
| ] | ||
| # ??? | ||
| repeat = diction_name_count(students) | ||
| def max_name(diction): |
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.
💡 Непонятно без контекста, что там в этом diction
| repeat = diction_name_count(students) | ||
| def max_name(diction): | ||
| max_count = 0 | ||
| for name,count in diction.items(): |
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 classes in range(len(school_students)): | ||
| print(f'Самое частое имя в классе {classes+1}: {max_name(diction_name_count(school_students[classes]))} ') |
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.
👍 очень здорово, что пользуешься переиспользованием функций
💡 тут лучше бы зашел str.format, а не f-strings
| for n in student: | ||
| name = n['first_name'] | ||
| if is_male[name] == True: | ||
| boys.append(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.
💡 в целом верно, но тот же коммент, что вместо списка можно было бы просто использовать переменную число мальчиков и такую же для девочек и увеличивать его на 1
| count_boys = len(boys) | ||
| count_girls = len(girls) | ||
|
|
||
| if count_boys > clas_count_boys: |
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.