So I am trying to learn Python and was wondering how to repeat the char at an index given as an argument in a string. An example would be below
def repeatchar(origString, repeatCount, lettersToRepeat)
>>> repeatChar('cat', 3, 'cr')
'cccat'
I have the comparison of origString
and lettersToRepeat
. I am trying to figure out how to get the char that is in lettersToRepeat
to actually repeat repeatCount
times.