-1

I am trying to append and update the data in the dictionary. As a process, I was using the for loop to update the values in the dictionary. However, the key is the same but the values are different.

dict = 
dict[key1] = ['value1',value2,value3]
dict.update({key1:[value4,value5,value6]})

I need to update the data to the same key to a dictionary in different line. The following is the expected output: print(dict)

{'key1':['value1','value2','value3'],
 'key1':['value4','value5','value6']}

can someone help to fix the issue?

karthik
  • 417
  • 1
  • 7
  • 15

1 Answers1

1

This is totally wrong, the whole point of dictionary's is to have different key's and to assign them the same or different values, dictionary's are for storing values based on different keys, so you can access them later. For more information click on this LINK

The shape
  • 359
  • 3
  • 10