Is that what you meant?
Output:
I am first apple
I am second cherry
I am third banana
I am first apple
I am second cherry
I am third banana
I am first apple
I am second cherry
I am third banana
Code:
def main_func():
fruits = ["apple", "cherry", "banana"]
for index, fruit in enumerate(fruits):
def first():
print("I am first", fruit)
def second():
print("I am second", fruit)
def third():
print("I am third", fruit)
if index == 0:
first()
elif index == 1:
second()
else:
third()
for i in range(3):
main_func()