Skip to content
Advertisement

With python; Getting index of wrong item of list [closed]

I’m trying to get the indeces of the items of my list but on one item it returns a wrong index. There are two numbers who are the same in the list, maybe it confuses it with the first one.

The list is: [0,1,0,0,0,0,0,0,0,0,6,1,0]

JavaScript

“print(Zahl)” returns these sums: 8 17 8 (should be 18) Maybe someone got an idea why this happens, thanks in advance.

Advertisement

Answer

Use enumerate:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement