List changes unexpectedly after assignment. Why is this and how can I prevent it?
Asked 07 September, 2021
Viewed 1.7K times
  • 52
Votes

While using new_list = my_list, any modifications to new_list changes my_list every time. Why is this, and how can I clone or copy the list to prevent it?

22 Answer