Question: In this short programming project you will be writing a function that takes a list, and index, and a direction ( left or
In this short programming project you will be writing a function that takes a list, and index, and a direction left or "right" as arguments. The goal of the function is to move the item at index to the provided direction skipping over all zeros and taking the place of another item that is not zero. If reaching the end either left or right end and all of the items are zero, take place of the last item.
Name the program moveitem.py Make sure that gradescope gives you the points for passing the test cases.
Examples
originallist abc
print moveitemoriginallist, "left"
bc
originallist abc
print moveitemoriginallist, "right"
ab
# call the function again
print moveitemoriginallist, "right"
ab
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
