Question: Complete the following function according to its docstring. Use a for loop. The lists we test will not all be shown; instead, some will

Complete the following function according to its docstring. Use a for loop. The lists we test will not all be Complete the following function according to its docstring. Note: this function should return None. Its job

Complete the following function according to its docstring. Use a for loop. The lists we test will not all be shown; instead, some will be described in English. If you fail any test cases, you will need to read the description and make your own test. 1 def first_even (items: list[int]) -> int: 2 """Return the first even number from items. Return -1 if items contains no even numbers. 4 5 6 8 >>> first_even ([5, 8, 3, 2]) 8 >>> first_even([7, 1]) -1 11 Complete the following function according to its docstring. Note: this function should return None. Its job is to modify the list passed as its argument. 1 def swap_name(name_list: list[str]) -> None: 2 3 4 5 6 7 8 9 10 11 12 13 """name_list contains a single person's name. Modify name_list so that the first name and last name are swapped. >>> name= ['John', 'Smith'] >>> swap_name (name) >>> name ['smith', 'John'] >>> name = ['John', 'Andrew', 'Gleeson', 'Smith'] >>> swap_name (name) >>> name ['Smith', 'Andrew', 'Gleeson', 'John'] ******

Step by Step Solution

3.45 Rating (152 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

1 firsteven function Python def firstevenitems listint int Return th... View full answer

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!