For example:
MyDict = {"dog" : 3, "cat" : 5}
How do I make it like this:
MyDict = {"cow" : 7, "dog" : 3, "cat" : 5}
With minimal code?
For example:
MyDict = {"dog" : 3, "cat" : 5}
How do I make it like this:
MyDict = {"cow" : 7, "dog" : 3, "cat" : 5}
With minimal code?
Assuming we're talking Python 3.7+ (so that dictionaries have fixed order), this should do:
MyDict = {"dog" : 3, "cat" : 5}
MyDict = {"cow": 7, **MyDict}