Python for loops and comprehension for loops

前端 未结 3 610
无人及你
无人及你 2021-01-24 03:45

Can someone explain to me why would this two statements (the for loop and the comprehension ) return two different answers. I thought they were the same, just different ways of

3条回答
  •  独厮守ぢ
    2021-01-24 04:26

    In the second approach you are editing your vector. While the for loop will save it (in the background) to avoid the unwanted edits!

提交回复
热议问题