Question: Specification: multCenter ( S , i , j ) takes a sequence, S , an integer i # < = len ( S ) and

Specification: multCenter(S, i, j) takes a sequence, S, an integer i
# <= len(S) and an integer j, and returns a new sequence that is
# identical to the sequence S but with the centermost i elements of S
# replicated j times.
#
# Note: "centermost" may not be exact if S is of odd length and i is
# even (or if S is of even length and i is odd). In such cases,
# "centermost" should shift towards the beginning of the sequence (see
# first and third examples below).
#
# Example:
# >>> multCenter((1,2,3,4,5,6),1,3)
# (1,2,3,3,3,4,5,6)
# >>> multCenter((1,2,3,4,5,6),2,2)
# (1,2,3,4,3,4,5,6)
# >>> multCenter("abcdefghi",4,2)
# 'abcdefcdefghi'
# >>> multCenter((1,2,3,4,5,6),2,0)
# (1,2,5,6)
What is the speed of the flea?

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!