Skip to content

Commit

Permalink
Create Second Largest And Smallest.py
Browse files Browse the repository at this point in the history
  • Loading branch information
AKA-Akhil authored Jan 24, 2024
1 parent c0cd518 commit f362849
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Second Largest And Smallest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
def find_len(listA):
length = len(listA)
listA.sort()

print("Second Largest element is:", listA[length-2])
print("Second Smallest element is:", listA[1])

listA = []

n = int(input("Enter number of elements in the list : "))

listA = list(map(int,input("Enter the numbers : ").strip().split(',')))[:n]
print("The entered list is: \n",listA)
Largest = find_len(listA)

0 comments on commit f362849

Please sign in to comment.