How to re-order the number after write a for loop

so i have a list/array in python code. So this is the code :

array = ["Jouzu", "Julio", "Jovana",["Jo","Ju","Jopa"]]
array.insert(3,"Arisman")
array[4].extend(["Aki","Nini"])
del array[4][3:]
array.append(["Aki","Nini"])
array[4].insert(0,"Papa")
array[4].insert(1,"Mama")
array.insert(5,"Moch. Arifandi")
array.insert(6,"Siti Aisyah")
array.insert(4,"Ine Pranina")
print(array)

for nomor, member in enumerate(array):
    if member == array[5]:
        continue
    elif member == array[8]:
        break
    print(nomor,member)

But after i print out, something odd show up

['Jouzu', 'Julio', 'Jovana', 'Arisman', 'Ine Pranina', ['Papa', 'Mama', 'Jo', 'Ju', 'Jopa'], 'Moch. Arifandi', 'Siti Aisyah', ['Aki', 'Nini']]
0 Jouzu
1 Julio
2 Jovana
3 Arisman
4 Ine Pranina
6 Moch. Arifandi
7 Siti Aisyah

yeah, i remove the 2 items in list but i want to re order the number back again so it should be 0,1,2,3,4,5,6



Read more here: https://stackoverflow.com/questions/66272323/how-to-re-order-the-number-after-write-a-for-loop

Content Attribution

This content was originally published by Mr. Jonerock at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: