- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
Finding Students with Second Lowest Grade – One-Liner Version #Python #HackerRank #NestedLists
This video presents a compact one-liner solution for the HackerRank problem of identifying student(s) with the second lowest grade. We efficiently build a nested list from the input, determine the second lowest grade using set operations and sorting, and then print the student names in alphabetical order – all in one concise code snippet.
How It Works:
Input & List Construction:
Read the number of students and build the nested list by reading names and grades.
#InputHandling #ListComprehension
One-Liner Extraction:
Utilize set and list comprehensions along with sorting to identify and print the names of students with the second lowest grade.
#OneLiner #PythonTricks
Output:
The result is printed with each name on a new line.
#Output #Result
Copy and paste the code below into your Jupyter Notebook to try the compact solution!
Code for Compact One-Liner Version (Copy-Paste in Jupyter Notebook):
if __name__ == '__main__':
students = [[input().strip(), float(input().strip())] for _ in range(int(input().strip()))]
[print(name) for name in sorted([s[0] for s in students if s[1] == sorted({s[1] for s in students})[1]])]
Видео Finding Students with Second Lowest Grade – One-Liner Version #Python #HackerRank #NestedLists канала CodeVisium
How It Works:
Input & List Construction:
Read the number of students and build the nested list by reading names and grades.
#InputHandling #ListComprehension
One-Liner Extraction:
Utilize set and list comprehensions along with sorting to identify and print the names of students with the second lowest grade.
#OneLiner #PythonTricks
Output:
The result is printed with each name on a new line.
#Output #Result
Copy and paste the code below into your Jupyter Notebook to try the compact solution!
Code for Compact One-Liner Version (Copy-Paste in Jupyter Notebook):
if __name__ == '__main__':
students = [[input().strip(), float(input().strip())] for _ in range(int(input().strip()))]
[print(name) for name in sorted([s[0] for s in students if s[1] == sorted({s[1] for s in students})[1]])]
Видео Finding Students with Second Lowest Grade – One-Liner Version #Python #HackerRank #NestedLists канала CodeVisium
Комментарии отсутствуют
Информация о видео
24 марта 2025 г. 13:25:12
00:00:10
Другие видео канала





















