Conversation
| names = ['Оля', 'Петя', 'Вася', 'Маша'] | ||
| # ??? | ||
| for name1 in names: | ||
| print(name1) |
| names = ['Оля', 'Петя', 'Вася', 'Маша'] | ||
| # ??? | ||
|
|
||
| for name3 in names: |
There was a problem hiding this comment.
💡 можно не менять названия переменным и использовать тот же name
| names = ['Оля', 'Петя', 'Вася', 'Маша'] | ||
| # ??? | ||
| for name in names: | ||
| if is_male[name] == False: |
There was a problem hiding this comment.
💡 еще можешь использовать тернарный оператор:
gender = 'мужской' if is_male[name] else 'женский'| ['Оля', 'Петя', 'Гриша'], | ||
| ] | ||
| # ??? | ||
| for group in range(1,len(groups)+1): |
There was a problem hiding this comment.
👍 хорошее решение, есть еще попроще метод (а мы такие любим):
for idx, group in enumerate(groups, start=1):| ] | ||
| # ??? No newline at end of file | ||
| for name in range(len(groups)): | ||
| names = ', '.join(groups[name]) |
| ] | ||
| # ??? | ||
| repeat = diction_name_count(students) | ||
| def max_name(diction): |
There was a problem hiding this comment.
💡 Непонятно без контекста, что там в этом diction
| repeat = diction_name_count(students) | ||
| def max_name(diction): | ||
| max_count = 0 | ||
| for name,count in diction.items(): |
| # ??? | ||
|
|
||
| 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.
👍 очень здорово, что пользуешься переиспользованием функций
💡 тут лучше бы зашел 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.
💡 в целом верно, но тот же коммент, что вместо списка можно было бы просто использовать переменную число мальчиков и такую же для девочек и увеличивать его на 1
| count_boys = len(boys) | ||
| count_girls = len(girls) | ||
|
|
||
| if count_boys > clas_count_boys: |
There was a problem hiding this comment.
👍 это задание тут самое сложное и сделано верно
No description provided.