Robert H. answered 03/04/23
Software Professional specializing in Math, Computer Science
Here's one approach using a nested helper function:
def get_last(lst):
def last_in_list(lst):
if(len(lst) > 0):
return lst[-1]
return 0
return [last_in_list(x) for x in lst]