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
In the second approach you are editing your vector. While the for loop will save it (in the background) to avoid the unwanted edits!