Question: spliceEnds(S, i) takes a sequence, S, and an integer, # i, and returns a (new) sequence consisting of the last i elements of # S
spliceEnds(S, i) takes a sequence, S, and an integer, # i, and returns a (new) sequence consisting of the last i elements of # S spliced with S spliced with the first i elements of S. # # Note: no assignment is needed: your solution should not use # if/elif/else, and should function appropriately even if i > # len(S).
Examples: # >>> spliceEnds((1, 3, 5, 6), 2) # (5, 6, 1, 3, 5, 6, 1, 3) # >>> spliceEnds("0123456", 3) # '4560123456012'
In python
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
