Question: in python please Now solve the following exercises on your own and submit them at the web link given at the end of this handout.

in python please in python please Now solve the following exercises on your own

and submit them at the web link given at the end of

Now solve the following exercises on your own and submit them at the web link given at the end of this handout. REMEMBER that when you write functions, you must use a return statement to be able to return the computed result L06.1: (Exercise 10.4) Write a function called middle() that takes a list and returns a new list that contains all but the first and last elements. For example, middle( [1, 2, 3, 4, 5] ) should return the list [3] , but middle( [1, 2, 3, 4] ) should return [2, 3] . ENTER YOUR CODE BELOW [38]: def middle( ist ): pass L06.3: Write a function called list_map( func, ist ) that takes a unary function (i.e., function that takes a single argument) and a list. This function should map the given function to the given list and return a new list with the given function applied to each item of the input list. For example, L = (1, 2, 3, 4, 5] def mul_by_3( x ): return x * 3 R = list_mapmul_by_3, L) print( R ) should print out [3, 6, 9, 12, 15] In addition, demonstrate that your function works using two other example unary functions. ENTER YOUR CODE BELOW I): def list_map( func, ist ): pass

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!