Logo
TGCATALOG
Catalog Collections Blog
Python Interview Questions - tests

Python Interview Questions - tests

Questions, tests and tasks for Python interviews.

No ratings
599
29.10.2026
599
29.10.2026
No ratings
599
29.10.2026
Safe redirect via bot
О канале

Questions, tests and tasks for Python interviews.

Подписчиков 12,566
Тематика Technology
Язык English
Ссылка t.me/python_easy_ru

We also recommend

Kekaton AI | Voiceover and voice clone
Kekaton AI | Voiceover and voice clone
Bot

AI bot for text-to-speech and voice cloning in Telegram. Create audio using neural network quickly and easily.

Description

Channel with questions for Python interviews. Tests, tasks and materials for preparation.

Latest posts

Python Interview Questions - tests
Python Interview Questions - tests
🔒Открыть пост
и посмотреть медиа
🤔 Как отсортировать список словарей по определенному полю? Для сортировки списка словарей по определенному полю в Python удобно использовать функцию sorted() или метод sort(). Оба подхода позволяют указать ключ сортировки с помощью параметра key, где можно передать либо функцию, либо лямбда-выражение, которое извлекает значение из словаря для сортировки. 🚩Почему это важно? Списки словарей часто используются для хранения структурированных данных. Например, вы можете иметь список сотрудников, где каждый сотрудник представлен в виде словаря с полями, такими как имя, возраст и зарплата. Сортировка по определенному полю позволяет упорядочить данные, чтобы ими было проще пользоваться или отображать. 🚩Как это сделать? 🟠Использование функции `sorted()` Эта функция возвращает новый отсортированный список. employees = [ {"name": "Alice", "age": 30, "salary": 70000}, {"name": "Bob", "age": 25, "salary": 50000}, {"name": "Charlie", "age": 35, "salary": 120000} ] # Сортировка по возрасту sorted_employees = sorted(employees, key=lambda x: x["age"]) print(sorted_employees) Результат [{'name': 'Bob', 'age': 25, 'salary': 50000}, {'name': 'Alice', 'age': 30, 'salary': 70000}, {'name': 'Charlie', 'age': 35, 'salary': 120000}] 🟠Использование метода `sort()` Этот метод изменяет существующий список. employees = [ {"name": "Alice", "age": 30, "salary": 70000}, {"name": "Bob", "age": 25, "salary": 50000}, {"name": "Charlie", "age": 35, "salary": 120000} ] # Сортировка по зарплате employees.sort(key=lambda x: x["salary"]) print(employees) Результат [{'name': 'Bob', 'age': 25, 'salary': 50000}, {'name': 'Alice', 'age': 30, 'salary': 70000}, {'name': 'Charlie', 'age': 35, 'salary': 120000}] 🟠Сортировка в обратном порядке Установите параметр reverse=True, чтобы отсортировать в порядке убывания. sorted_employees_desc = sorted(employees, key=lambda x: x["age"], reverse=True) print(sorted_employees_desc) 🟠Использование функции `itemgetter` из модуля `operator` Это более эффективный способ, чем лямбда-функция, особенно для больших данных. from operator import itemgetter sorted_employees = sorted(employees, key=itemgetter("age")) print(sorted_employees) 🚩Обработка отсутствующих значений Если поле может отсутствовать в некоторых словарях, можно использовать параметр key для обработки таких ситуаций. employees = [ {"name": "Alice", "age": 30}, {"name": "Bob"}, {"name": "Charlie", "age": 35} ] sorted_employees = sorted(employees, key=lambda x: x.get("age", 0)) print(sorted_employees) Результат [{'name': 'Bob'}, {'name': 'Alice', 'age': 30}, {'name': 'Charlie', 'age': 35}] Ставь 👍 и забирай 📚 Базу знаний
Python Interview Questions - tests
FAQ

Open Python Interview Questions - tests in Telegram and press the Start button. No separate registration is required.

Yes. The service is designed to be straightforward: open the resource, follow the on-screen instructions and start using it.

No. You can use Python Interview Questions - tests directly in Telegram unless the resource description says otherwise.

Access depends on the resource. Check the current information in Telegram after opening Python Interview Questions - tests.

The exact features depend on the resource. Open Python Interview Questions - tests to see its current functions, content and access conditions.
Subscriber dynamics
+-1.0% last 30 days
Current
12,566
Month ago
12,694
Average growth
+-4 / day
Updated
2 hours ago

Reviews for channel Python Interview Questions - tests

Log in to leave a review

Only registered users can share their opinion.

No reviews yet

Be the first to share your impression of this resource!

Similar resources

Loading
Switch to Light Theme
Home Catalog Collections Blog Login