- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
Find 2nd Largest Number in Python | Using Sort & Without Sort | Python Interview Question Explained
Welcome back to @ProgrammerChandra 👋
In this video, we’ll learn how to find the second largest number in a list using Python — a popular Python interview question!
We’ll explore two methods step by step 👇
✅ Method 1: Using sort() function
✅ Method 2: Without using sort — logic-based approach
This question is commonly asked in coding interviews to test your understanding of loops, conditions, and comparisons in Python.
By the end of this video, you’ll understand both methods clearly and be ready to tackle similar interview problems confidently.
# Method 1: Using sort()
nums = [10, 5, 8, 20, 15]
nums.sort()
print("Second Largest:", nums[-2])
# Method 2: Without using sort()
nums = [10, 5, 8, 20, 15]
first = second = float('-inf')
for n in nums:
if n greaterthan first:
second, first = first, n
elif n greaterthan second and n != first:
second = n
print("Second Largest:", second)
#pythoninterview #listcomprehension #pythonexamples #programmerchandra #findthelongestword #python #removeduplicate #string #pythontricks #fullstack #pythontips #pythonbeginners #webdev #shorts #codewithpython #beginnerpython #pythonforbeginners #youtubeshorts #coding #pythonprojects #opensource #programmingshorts #codewithme #programmingtutorial #beginnerfriendly #creativecoding #learntocode #codingshorts #learnpython #tutorial #pythonshorts #programming #python3 #codeart #developers #pythonsyntax #cleanCode #developer #codingtricks #pythontutorial #pythoncoding
Видео Find 2nd Largest Number in Python | Using Sort & Without Sort | Python Interview Question Explained канала ProgrammerChandra
In this video, we’ll learn how to find the second largest number in a list using Python — a popular Python interview question!
We’ll explore two methods step by step 👇
✅ Method 1: Using sort() function
✅ Method 2: Without using sort — logic-based approach
This question is commonly asked in coding interviews to test your understanding of loops, conditions, and comparisons in Python.
By the end of this video, you’ll understand both methods clearly and be ready to tackle similar interview problems confidently.
# Method 1: Using sort()
nums = [10, 5, 8, 20, 15]
nums.sort()
print("Second Largest:", nums[-2])
# Method 2: Without using sort()
nums = [10, 5, 8, 20, 15]
first = second = float('-inf')
for n in nums:
if n greaterthan first:
second, first = first, n
elif n greaterthan second and n != first:
second = n
print("Second Largest:", second)
#pythoninterview #listcomprehension #pythonexamples #programmerchandra #findthelongestword #python #removeduplicate #string #pythontricks #fullstack #pythontips #pythonbeginners #webdev #shorts #codewithpython #beginnerpython #pythonforbeginners #youtubeshorts #coding #pythonprojects #opensource #programmingshorts #codewithme #programmingtutorial #beginnerfriendly #creativecoding #learntocode #codingshorts #learnpython #tutorial #pythonshorts #programming #python3 #codeart #developers #pythonsyntax #cleanCode #developer #codingtricks #pythontutorial #pythoncoding
Видео Find 2nd Largest Number in Python | Using Sort & Without Sort | Python Interview Question Explained канала ProgrammerChandra
pythoninterview listcomprehension pythonexamples programmerchandra findthelongestword python removeduplicate string pythontricks fullstack pythontips pythonbeginners webdev shorts codewithpython beginnerpython pythonforbeginners youtubeshorts coding pythonprojects opensource programmingshorts codewithme programmingtutorial beginnerfriendly creativecoding learntocode codingshorts learnpython tutorial pythonshorts programming python3 pythonsyntax cleanCode codingtricks pythontutorial pythoncoding
Комментарии отсутствуют
Информация о видео
14 января 2026 г. 23:03:17
00:01:19
Другие видео канала




















