zjfz-2019-s439462/intro/Task106.py

5 lines
143 B
Python
Raw Normal View History

2020-01-12 14:35:16 +01:00
def penultimate(l: list, otherwise: object) -> object:
if (not l) or (len(l) == 1):
return otherwise
else:
return l[-2]