Mar-10-2018, 12:06 AM
from __future__ import division import time, math List = [3,4,6] MADlist = List for i in range(len(MADlist)): MADlist[i] -= mean MADlist[i] = math.fabs(MADlist[i]) MADsum = float(sum(MADlist)) MAD = MADsum/(len(MADlist))Here's my code.
I have a list called List. I want to make some changes without actually changing List, so I create another list, MADlist, to make changes to while keeping the original list the same. For whatever reason, it makes the same changes to the original list too! Why?