Python: Difference between Change and Update in Dictionaries
Created 1 year ago
165
Views
0
Comments
What is the actual difference between Change and Update function in Dictionaries?
suppose we have dictionaries
dictt={
name:"Minkon",
age:34,
address:"Guwahati"
}
Now if we want to change the address to Bangalore, the syntax will be
dictt["address"]="Bangalore"
now print(dictt) will show the changed value of address as Bangalore
Now instead of using change method, if we use the update method, the value will change whatever the argument we pass through it. As like
dictt.update({"address":"Bangalore"})
and now print(dictt) will aslo give the same result as we suppose to get in change method.
Explanation is highly appreciable in terms of the difference between these two methods.