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 move_item.py. Make sure that gradescope gives you the points for passing the test cases.
Examples
```
original_list =["a",0,0,"b","c",0,0]
print( move_item(original_list, 3, "left"))
['b',0,0,0,'c',0,0]
original_list =["a",0,0,"b","c",0,0]
print( move_item(original_list, 3, "right"))
['a',0,0,0,'b',0,0]
# call the function again
print( move_item(original_list, 4, "right"))
['a',0,0,0,0,0,'b']
```
In this short programming project you will be

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!