Oct-22-2020, 09:11 AM
(Oct-22-2020, 07:57 AM)Axel_Erfurt Wrote:def tag(s): count = len(s) for i in range(count): res = f"{s[:1]}{''.join([char*2 for char in s[1:]])}" return res print(tag("Tom"))
Thanks for the quick response. The code you have suggested seems to print all letters twice other than the first letter. looks like we are joining the first character
{s[:1]}with twice
char*2every other character
for char in s[1:]