task_6.py
"""
6. Почти реальная задача
Дан список пользователей:
Выведи номер пользователя (с 1) и имя только неактивных.
Ожидаемый вывод:
2 John
4 Mike
"""
: =
: =
return
return
return
: =
: =
return
return
: =
: =
: =
"""
users: list[dict[str, str | bool]] = [
{"name": "Alex", "active": True},
{"name": "John", "active": False},
{"name": "Kate", "active": True},
{"name": "Mike", "active": False},
]
# BASE SOLUTION
def get_users(users: list[dict[str, str | bool]]) -> None:
for id, user in enumerate(users, 1):
if isinstance(user.get("active"), bool) and user["active"] == False:
print(id, user["name"])
"""
=
=
# get_users(users=users, status=False)