I am just getting started on functions in Python. My goal is to loop a list with fruits and for each fruit, print it's letters backwards. When it hits a special character, it will stop and move on to the next fruit. I tried doing this with a loop and adding to the index each time but it would only print the first fruit correctly. If I just put the code for each fruit five times, it works perfectly. Please help me fix the index. Code is below.
def reverse(li):
c = 1
while c == 1:
index = 0
for c in reversed(li[index]):
if c.isalpha():
print(c, end="")
index += 1
else:
print()
index += 1
break
fruits = ['ap!ple','bana@na','ma%ngo','#orange','pine*apple']
reverse(fruits)
'ap!ple'are you expecting'pa'or'elp'?