1

I've been reading a book "Python Crash Course 2nd Edition" and saw this phrase:

A for loop is effective for looping through a list, but you shouldn’t modify a list inside a for loop because Python will have trouble keeping track of the items in the list

'You shouldn’t modify a list inside a for loop because Python will have trouble keeping track of the items in the list' That confused me. I don't understand what this means. That's basically it.

To sum up, my question is Why not to modify lists in for loops in Python?

Coder4Fun250
  • 207
  • 1
  • 6

0 Answers0