You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>>> def secondsmallest(L):
... a, b = None, None
... for item in L:
... if a is None or item <= b:
... a, b = item, a
... elif b is None or item <= a:
... b = item
... return b
>>> secondsmallest([4, 5, 1, 2, 3])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 4, in secondsmallest
TypeError: '<=' not supported between instances of 'int' and 'NoneType'
secondsmallest() does not account for when the second element in L is larger than the first element.
The text was updated successfully, but these errors were encountered:
For example:
secondsmallest()
does not account for when the second element inL
is larger than the first element.The text was updated successfully, but these errors were encountered: