Skip to content

Write a Python program to find the third largest/smallest number in a list.

Class 11th IP (065)

Write a Python program to find the third largest/smallest number in a list.

SOLUTION..

lst = [] n = int(input("Enter how many numbers you want to add: ")) for i in range(n): num = int(input(f"Enter number {i+1}: ")) lst.append(num) lst.sort() print("Sorted List:", lst) print("Third Smallest =", lst[2]) print("Third Largest =", lst[-3])