Suppose I have a list nums = [1,3,2,5,6] and I want to subtract each element's value by 1. Now I wrote codes like
for i in nums:
i -= 1
However, when I print nums its values did not change. I'm wondering why it doesn't work, and whether there is an elegant way in Python to do this. Thank you!