Python Find Second Largest Number In List
In this post , we will see how to find second maximum number in list
Second Highest Number In List
How To Find Second Largest Number In List Using Python
Firstly we need to ask user to enter total count of numbers they want to store. After that we will append them in a list.
Python Code To Find Second Maximum Number In Python
nums=[]
b=int(input("Total Numbers You Want To Enter : "))
for x in range(0,b):
en=input()
nums.append(en)
print(nums)
nums.sort()
final=set(nums)
highest=max(nums)
final.remove(highest)
print("Second Largest Number Is : ",max(final))
Output |
.
Post a Comment