-
Notifications
You must be signed in to change notification settings - Fork 260
задание по for готово #44
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
for_challenges.py
Outdated
|
||
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.
True, False, None в питоне являются синглтонами, поэтому сравнение с ними обычно делают через is вместо ==
if is_male[name] is False
for_challenges.py
Outdated
# ??? | ||
print(f'Всего {len(groups)} группы') | ||
number_group = 1 | ||
for number_persons in 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
for number_group, number_persons in enumerate(groups, start=1):
...
for_challenges.py
Outdated
number_group = 1 | ||
for names in 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
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 name in names: | ||
if is_male[name] is 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.
как бы ты разрулил случай, когда имя отсутствует в is_male ?
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 вытащить key, value. Так for key, value in is_male, а потом так же через if. Правильно понял вопрос?
@@ -40,18 +45,25 @@ | |||
['Вася', 'Маша', 'Саша', 'Женя'], | |||
['Оля', 'Петя', 'Гриша'], | |||
] | |||
# ??? | |||
print(f'Всего {len(groups)} группы') | |||
for index, name in enumerate(groups, start=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 index, names in enumerate(groups, start=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.
👍
|
||
|
||
# Вывести количество гласных букв в слове | ||
word = 'Архангельск' | ||
# ??? | ||
count = 0 | ||
for i in word.lower(): |
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_word = len(sentence.split()) |
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.