Question 100 reverse first and ,last

def str_list_func(s):
    l = s.split(' ')
    i = 0
    for element in l:
        if len(element) > 1:
            first = element[0]
            last = element[len(element)-1]
            middle = element[1:len(element)-1]
            l[i] = last + middle + first
        i+=1
    return ' '.join(l)

I did not understand.

Why did you use index0, index of the middle and last index??

we can work with first and last index also.

What is the use of i??

Please clarify.