How to multiply every letter in a string by N with Python

1 Answer

0 votes
def double_letters(s):
    return ''.join([x * 5 for x in s])


s = "Python"
s = double_letters(s)

print(s) 



'''
run:

PPPPPyyyyyttttthhhhhooooonnnnn

'''

 



answered Sep 25, 2019 by avibootz
...