+ 2
In Python, dictionary keys must all be unique with one another. Here the dict1 and dict2 merge or concatenate. Now the dictionary will look like this: dict3 = {'Ten': 10, 'Twenty': 20, 'Thirty': 30, 'Thirty': 30, 'Fourty': 40, 'Fifty': 50} But since dictionary keys must be unique, the first "Thirty" key (which is not a unique key), should be removed. Therefore, the dict3 will look now like this: dict3 = {'Ten': 10, 'Twenty': 20, 'Thirty': 30, 'Fourty': 40, 'Fifty': 50} - - - - - - - - - - - - - - - - - - Try this and the value of 'Thirty' would be 25 because it gets the last or the last declared similar key. dict3 = {'Ten': 10, 'Twenty': 20, 'Thirty': 30, 'Thirty': 25, 'Fourty': 40, 'Fifty': 50} duct3 = {'Ten': 10, 'Twenty': 20, 'Thirty': 25, 'Fourty': 40, 'Fifty': 50}
15th Jan 2021, 4:53 PM
noteve
noteve - avatar