Question: Write a function shrink(L) which returns a reversed copy of a list L without the first and last items! Use the docstring Returns a reversed

Write a function shrink(L) which returns a reversed copy of a list L without the first and last items!

Use the docstring """Returns a reversed copy of the list L without the first and last items""".

Do not change the main program. Expected output:

['i', 'h', 'g', 'f', 'e', 'd', 'c', 'b']
['c', 'd', 'e', 'f', 'g', 'h']

Make sure that your function works correctly for any list L with two or more items.

# Main program (do not change): letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] print(shrink(letters)) print(shrink(shrink(letters)))

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 Databases Questions!