List of items are there as a map object. I have to iterate this 2 times to get an answer. Is this possible without converting into a list?
if __name__ == '__main__':
arr = map(int, input().split())
large = 0
for item in arr:
if item > large:
large = item
print(large)
second = 0
for item in arr:
if item < large and item > second:
second = item
print(second)
Expected result for an input of "2 3 4 6 6" is 6 4
Result from the above code is 6 0