You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
def second_smallest(numbers):
|
|
a1, a2 = float('inf'), float('inf')
|
|
for x in numbers:
|
|
if x <= a1:
|
|
a1, a2 = x, a1
|
|
elif x < a2:
|
|
a2 = x
|
|
return a2
|
|
print(second_smallest([1, 2, -8, -2, 0])) |