In the code below the dictionary used as input argument is also being modified by the function. Do I have to% always%?
def muda(a):
a['valor'] = 50
return a
dic1 = {'valor': 12}
dic2 = muda(dic1)
print(dic1)
{'valor': 50}
print(dic2)
{'valor': 50}
from copy import deepcopy
dic1 = {'valor': 12}
dic2 = muda(deepcopy(dic1))
print(dic1)
{'valor': 12}
print(dic2)
{'valor': 50}