if __name__ == '__main__':
    arr = map(int, input().split())
    a = max([x for x in arr if x != max(arr)])
    print(a)
sample input: 1 2 3 4 5
goal here is to find second greatest number
type(max(arr)) is integer,
each element type in arr when looping is integer,
so why output isnt 4? This works perfectly only when I do arr = list(arr) but I want to know why wouldnt it work without it?
 
     
     
    