An easy implementation would be to do something like:
if len(set(input)) == 1:
print('not present')
else:
sorted(set(input))[-2]
Take a look at Get the second largest number in a list in linear time for other implementations.
6
solved Need to find second maximum number in the list. All the details pasted below in the body. Please assist