Question: Part B None of the solutions requires a loop. Your solutions can use: the [ ] operator to get and set list elements ( e

Part B
None of the solutions requires a loop.
Your solutions can use:
the [] operator to get and set list elements (e.g., a = lst[i] and lst[i]= a);
the in and not in operators (e.g., a in lst);
the list concatenation operator (e.g., lst1+ lst2);
the list replication operator (e.g., lst *n or n**1st);
the del operator (e.g., del lst[0]);
Python's built-in len, min and max functions.
Your solutions cannot use:
for or while loops;
list slicing (e.g., slice = lst[i : j] or (lst[i : j]= t);
Python's built-in sum, reversed and sorted functions;
any of the methods provided by type list; e.g., append, clear, copy, count, extend, index, insert, pop, remove, reverse and sort;
list comprehensions (which aren't covered in the textbook or ECOR 1041).
Exercise 4
Use the function design recipe from Chapter 3 of Practical Programming to develop a function named middle_way. The function takes two lists that each contain three integers; in other words, the function has two parameters, both parameters are lists, and both lists contain three integers. The function returns a new list containing the middle elements from both lists. For example, when the arguments are 1,2,3 and 4,5,6, the function returns 2,5.
Your function definition must have type annotations and a complete docstring. Use the Python shell to test middle_way.
Part B None of the solutions requires a loop.

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 Programming Questions!