Question: ###################################################################### # Specification: spliceEnds(S, i) takes a sequence, S, and an integer, # i, and returns a (new) sequence consisting of the last i elements

###################################################################### # Specification: 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). As with Qotd2, a single expression in the return suffices. # # Examples: # >>> spliceEnds((1, 3, 5, 6), 2) # (5, 6, 1, 3, 5, 6, 1, 3) # >>> spliceEnds("0123456", 3) # '4560123456012' # def spliceEnds(S, i): pass # Start here: replace this line with your code.

###################################################################### # MAKE NO CHANGES BEYOND THIS POINT. ###################################################################### if __name__ == '__main__': if type(signed()) is not list: print('### Error: signed() must return list of hawkid(s). ') exit() if signed()[0] == "hawkid": print('### Error: signed() must return your hawkid. ') exit() if spliceEnds("012345", 8)!='012345012345012345': print('### Error: spliceEnds("012345", 8) returns {}, expected \'012345012345012345\''.format(spliceEnds("012345", 8))) if spliceEnds(list(range(3, 14, 3)), 2)!=[9, 12, 3, 6, 9, 12, 3, 6]: print('### Error: spliceEnds({}, 2) returns {}, expected [9, 12, 3, 6, 9, 12, 3, 6] '.format(list(range(3, 14, 3)), spliceEnds(list(range(3, 14, 3)), 2))) in python please.

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!