0

Hello I need help in this exercise in python, I can't solve it.

Let's test your coding skills! Take a string as input and output each letter of the string on a new line, repeated N times, where N is the position of the letter in the string. Sample Input: data Sample Output: d aa ttt aaaa

8th May 2021, 1:54 PM
Mohamad
6 odpowiedzi
+ 3
This is my approach. Mohamad s="data" for i in range(len(s)): print(s[i]*(i+1))
8th May 2021, 3:57 PM
MrMysterious5
+ 2
Where is your try ?
8th May 2021, 2:06 PM
Ayush Kumar
Ayush Kumar - avatar
+ 2
You can take the input into a char array and its index give you the number of position and repeating.
8th May 2021, 2:22 PM
JaScript
JaScript - avatar
0
Can you write it?
8th May 2021, 3:55 PM
Mohamad
0
Thanks mate yeah this is right
8th May 2021, 4:00 PM
Mohamad
0
Let s test your coding skills! Take a string as input and output each letter of the string on a new line, repeated N times, where N is the position of the letter in the string. Sample Input: data Sample Output: d aa ttt aaaa #This is my approach. Hamzah s=input() print() for i in range(len(s)): print(s[i]*(i+1))
19th Jan 2023, 6:01 PM
Hamzah Ali Musaed Naji Alhaidari
Hamzah Ali Musaed Naji Alhaidari - avatar