Setting largest2 to 0 just complicates the if statement later. Set it to the smallest value in the array and it becomes clearer.
n=4
a1 = '-7 -7 -7 -7 -6'
a1=[int(arr_temp) for arr_temp in a1.strip().split(' ')]
print(a1)
largest = max(a1)
largest2 = min(a1)
for i in range(0,len(a1)):
if (a1[i] > largest2) and (a1[i] < largest):
largest2 = a1[i]
print(largest2)
Note that if the array is large, the call to min becomes non-trivial. In that case you could set largest2 to the smallest value possible (on that note, this link might be useful)