I wanted to reverse a list, and I managed to do so, but in the middle of the work I noticed something strange. The following program works as expected but uncommeting line <
list and reversed_list are the same list. Therefore, changing one also changes the other.
list
reversed_list
What you should do is this:
reversed_list = list[::-1]
This reverses and copies the list in one fell swoop.