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
Get step-by-step solutions from verified subject matter experts
