Let's rewrite it a bit, because I don't think
index
is what you think it is.>>> CORRECT_ANSWERS = ["A" , "C" , "A" , "A" , "D" , ... "B" , "C" , "A" , "C" , "B" , ... "A" , "D" , "C" , "A" , "D" , ... "C" , "B" , "B" , "D" , "A"] >>> for index in CORRECT_ANSWERS: ... print(index) ... A C A A D B C A C B A D C A D C B B D AIf you actually do want the index, and not the elements of the list, then
enumerate()
is your hero.>>> for index, item in enumerate(CORRECT_ANSWERS): ... print(f"{index} => {item}") ... 0 => A 1 => C 2 => A 3 => A 4 => D 5 => B 6 => C 7 => A 8 => C 9 => B 10 => A 11 => D 12 => C 13 => A 14 => D 15 => C 16 => B 17 => B 18 => D 19 => AIf you look back at your previous code, you were looping over
range(len(CORRECT_ANSWERS))
, but now you're looping over the list directly, which doesn't give indices.