Question: Write the python function swap_lists that takes four inputs (list1, ind1, list2, ind2), and returns two outputs new_list1 and new_list2. list1 and list2 are lists
Write the python function swap_lists that takes four inputs (list1, ind1, list2, ind2), and returns two outputs new_list1 and new_list2. list1 and list2 are lists of strings and has the same number of elements and ind1 and ind2 are integers. Your function is supposed to swap the element that has index 'ind1' in list1 with the element that has 'ind2' in list2.
For example, if list1=['cats', 'dogs', 'shark','fish'] and list2 = ['canary', 'parrot', 'cockatoo','lovebird'] and ind1 is 2 and ind2 is 1, your script should return new_list1= ['cats', 'dogs', parrot','fish'] and new_list2= ['canary', 'shark', 'cockatoo','lovebird']
------------------use template below
def swap_lists(list1, ind1, list2, ind2): ### BEGIN SOLUTION ### END SOLUTION
return new_list1, new_list2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
