Oct-20-2020, 07:57 AM
With a list, you can append a new value into the list.
>>> l = [1, 2] >>> l.append(3) >>> l [1, 2, 3]With a dict, you can add a key/value pair that wasn't there before, or you can update it with another dict, and that either add or changes the values of any matching keys.
>>> d = {'a': 1, 'b': 2} >>> d['c'] = 3 >>> d.update({'d': 4}) >>> d {'a': 1, 'b': 2, 'c': 3, 'd': 4}