Skip to content

задание по 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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

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

@@ -40,18 +45,25 @@
['Вася', 'Маша', 'Саша', 'Женя'],
['Оля', 'Петя', 'Гриша'],
]
# ???
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.

👍

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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy