# Write a function that takes a list. # # For example if the two lists are [1,2,3] and [4,5,6,7], # your code would return [5, 7, 9, 7] # # Do not use any built-in functions except len() def sum_lists(lst1, lst2): result = [] index = 0 length = 0 # because we don't know if the two lists are # of the same size, we need to determine # how many times we want to repeat # (how many iterations needed) # to avoid index error (from accessing item # outside of the list), # let's use the smaller size # and then keep the remaining items # of the bigger list if len(lst1) <= len(lst2): length = len(lst1) result = lst2 else: length = len(lst2) result = lst1 # repeat until all items of the smaller list # are computed while index < length: result[index] = lst1[index] + lst2[index] index += 1 # leave the remaining of the bigger list # in the resultant list return result print(sum_lists([1,2,3], [4,5,6,7]))