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
6 Antworten
+ 3
This is my approach. Mohamad
s="data"
for i in range(len(s)):
print(s[i]*(i+1))
+ 2
Where is your try ?
+ 2
You can take the input into a char array and its index give you the number of position and repeating.
0
Can you write it?
0
Thanks mate yeah this is right
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))