0
What is wrong with code ? Project 4.2 line them up
x=input() for c in x: if c==x: continue print (c*(int(x.index(c))+1)) Input: awesome Expected Output: a ww eee ssss ooooo mmmmmm eeeeeee Getting output except last line
3 odpowiedzi
+ 3
x = input()
for i, c in enumerate(x):
print(c*(i+1))
0
your code get first index of current char... as e occurs twice in 'awesome', second 'e' don't get the expected index ;P
0
#This will work
str = input()
i=1
for element in str:
print(element*i)
i=i+1