Your question is Python Element Swap Coding. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Teamware Solutions processes ordered items in Python lists and occasionally needs to exchange two positions without creating a second list. Implement a function that swaps the elements at two provided indices in place and returns the modified list.
Implement swap_elements(arr, index1, index2).
arr, a list of integers, and two valid zero-based integer indices, index1 and index2.index1 and index2 have been exchanged.def swap_elements(arr, index1, index2):