list = []
word = 'hello'
for i in word:
list.append(i)
for i in list:
print(list.index(i))
output:
0 1 2 2 4
I dont know how to make the second 'l' to have an index of 3 instead of 2. rindex() does not work on for the code that I am making