Oct-22-2020, 07:27 AM
For passing a parameter 'abcd' to function tag, the following result is expected tag("abcd") -> "abbcccdddd"
Now I am trying to append these values to '' empty string but, not getting the result
I have tried to print(i, val) and that seems to print correctly the expected characters.
But, could not append the same to empty string and output it.
Om
Now I am trying to append these values to '' empty string but, not getting the result
def tag(s): count = 0 res = '' for val in s: count += 1 for i in range(count): res.join(val) return res # Expecting Toommm print(tag("Tom"))Am I doing something wrong here?
I have tried to print(i, val) and that seems to print correctly the expected characters.
But, could not append the same to empty string and output it.
res.join(val) return res # Expecting ToommmThanks,
Om