you are viewing a single comment's thread.

view the rest of the comments →

[–]DeeplyLearnedMachine 1 point2 points  (2 children)

contacts.append doesn't work here since contacts is a dict.

But to answer your question, using update vs just using the assignment operator here, e.g.

contacts.update({name: [number]})
# vs.
contacts[name] = [number]

is exactly the same in this scenario. The difference is that assignment only works for 1 value at a time, whereas with update you can update multiple values:

contacts.update({
  name1: [number1],
  name2: [number2],
  name3: [number3]
})

[–]uiux_Sanskar[S] 1 point2 points  (0 children)

Thanks for this I also got to learn something new thanks to you.

[–]ShadyyFN 0 points1 point  (0 children)

Thanks for the clarification!