`
arr = map(int, input().split())
for i in reversed(sorted(list(arr))):
if i < sorted(list(arr))[-1]:
print(i)
break
`
hello i need to print the second highest value from a list of numbers from spaced input using a space
when i print ‘sorted(list(arr))[-1]’ i get the number in the last index but when i try to iterate through the list and use it as a comparison argument i get IndexError: list index out of range
i tested the type and it’s int for the item and the argument
and for minimum words count and people who love to vote down the question because they feel it’s not worth asking i did my best to solve the question if there is a solution that i messed point me towards it and i’ll delete the post