CPSC150A
Scientific Computing

Activity 19

Lists

Add Ends

Write the function add_ends(a_list) that computes the sum of the first and last elements of a list. The parameter a_list is a list of numbers with at least two elements. The function should return the sum of the first element and the last element from the list.

Test Cases

print('Input: ?\tActual: ', add_ends(?), '\tExpected: ?')