Question: Given a string and an int n, return a string made of n repetitions of the last n characters of the string. You may assume
Given a string and an int n, return a string made of n repetitions of the last n characters of the string. You may assume that n is between 0 and the length of the string, inclusive. You may use whichever loop you prefer! You may not use the * operator.
Example: repeatEnd("Hello", 3) "llollollo"
repeatEnd("Hello", 2) "lolo"
repeatEnd("Hello", 1) "o"
def repeatEnd(str, n):
#missing code
Help me with my python! please fill in the missing code :) Thank you so much!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
