0

Given a string, return a string where there are three characters for every character in the original.

Example: repeatCharacters('Hello') --> 'HHHeeellllllooo' repeatCharacters ('Mississippi') --> 'MMMiiissssssiiippppppiii'

4th Feb 2022, 7:28 AM
Jaz
Jaz - avatar
5 odpowiedzi
+ 2
def repeatCharacters(word): result="" for letter in word: result+=letter*3 return result sample="Hello" print(repeatCharacters(sample)) #output : HHHeeelllooo
4th Feb 2022, 8:14 AM
Jasy Fabiano
Jasy Fabiano - avatar
+ 2
Jasy Fabiano thank you
4th Feb 2022, 8:29 AM
Jaz
Jaz - avatar
+ 1
You are welcome buddy
4th Feb 2022, 8:30 AM
Jasy Fabiano
Jasy Fabiano - avatar
0
def reoeat(text): tripleWord="" for letter in range(len(text)): tripleWord = (text[letter]*3) print(tripleWord)
4th Feb 2022, 8:04 AM
Jaz
Jaz - avatar
0
def time_3(letter): a = [] for i in range(0,len(letter)): a.append(letter[i]*3) return ''.join(a) print(time_3('patel hir')) ANSWER WILL BE : pppaaattteeelll hhhiiirrr
1st Aug 2022, 5:51 AM
Hir patel
Hir patel - avatar