-
Notifications
You must be signed in to change notification settings - Fork 260
exersises #22
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?
exersises #22
Conversation
@@ -3,7 +3,7 @@ | |||
|
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.
не нужно в репозиторий добавлять служебные файлы
# ??? | ||
|
||
print(f"{len(groups)} всего групп") | ||
for index, group in enumerate(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.
можно в enumerate через start указать номер с которого начинать
@@ -12,8 +14,8 @@ | |||
{'first_name': 'Маша'}, | |||
{'first_name': 'Петя'}, | |||
] | |||
# ??? | |||
|
|||
for student in students: |
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.
Тут квадратичная сложность, потому что count будет весб список перебирать каждый раз. Лучше такого избегать
@@ -26,8 +28,8 @@ | |||
{'first_name': 'Маша'}, | |||
{'first_name': 'Оля'}, | |||
] | |||
# ??? | |||
|
|||
duplicates = [x for i, x in enumerate(students) if i != students.index(x)] |
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.
аналогично, index это как еще один цикл. Итого цикл в цикле
count_list = [] | ||
for dic_student in s_class: | ||
count_list.append(dic_student["first_name"]) | ||
count_dic = Counter(count_list) |
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.
можно сразу в коунтер добавлять без промежточного списка
# ??? | ||
|
||
word_one = 'Архангельск' | ||
glasniye = ["а", "я", "у", "ю", "о", "е", "ё", "э", "и", "ы"] |
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.