Skip to content

Conversation

@oltanik
Copy link

@oltanik oltanik commented Nov 26, 2023

No description provided.

# ???

for name in names:
if is_male[name] == False:

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

# ???
print(f'Всего {len(groups)} группы')
number_group = 1
for number_persons in groups:

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):
    ...

]
# ???
number_group = 1
for names in groups:

Choose a reason for hiding this comment

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

тоже через enumerate

Copy link

@skeapskeap skeapskeap left a 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:

Choose a reason for hiding this comment

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

как бы ты разрулил случай, когда имя отсутствует в is_male ?

Copy link
Author

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. Правильно понял вопрос?

]
# ???
print(f'Всего {len(groups)} группы')
for index, name in enumerate(groups, start=1):

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

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():

Choose a reason for hiding this comment

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

👍

# Вывести усреднённую длину слова в предложении
sentence = 'Мы приехали в гости'
# ???
count_word = len(sentence.split())

Choose a reason for hiding this comment

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

так тоже можно

Sign up for free to 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