Skip to content

задание по for готово#44

Open
oltanik wants to merge 4 commits intolearnpythonru:mainfrom
oltanik:main
Open

задание по for готово#44
oltanik wants to merge 4 commits intolearnpythonru:mainfrom
oltanik:main

Conversation

@oltanik
Copy link
Copy Markdown

@oltanik oltanik commented Nov 26, 2023

No description provided.

# ???

for name in names:
if is_male[name] == False:
Copy link
Copy Markdown

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:
Copy link
Copy Markdown

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

]
# ??? No newline at end of file
number_group = 1
for names in groups:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

тоже через enumerate

Copy link
Copy Markdown

@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:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
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):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

# ??? No newline at end of file


for index, names in enumerate(groups, start=1):
Copy link
Copy Markdown

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():
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

# Вывести усреднённую длину слова в предложении
sentence = 'Мы приехали в гости'
# ??? No newline at end of file
count_word = len(sentence.split())
Copy link
Copy Markdown

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