Repeating Index in List

def accum(s):
# your code
list =

for i in s:
  list.append(i.upper() + i.lower()*s.index(i))
return "-".join(list)

print(accum(“ZpglnRxqenU”)

You can see the return. The problem is that if the leter repeats its first index, how can i fix it ? if first N has index 4 , second N has 9 but it still gets index 4 ?
Thank you

As evidenced, index() always starts from the left edge and stops on the first encounter, hence index 4 on both calls.

Check the documentation to see if we are permitted to specify a starting index.