In Python, a Map is referred to as a Dictionary. To add a new key-value pair to a dictionary in Python, you can simply use the dictionary[key] = value syntax, where dictionary is the name of the dictionary, key is the new key you want to add and value is the corresponding value.
Here's an example:
main.py179 chars9 lines
In this example, the new key-value pair 'grape': 5 is added to the dictionary 'my_dict'. The output of the program will be:
main.py51 chars2 lines
gistlibby LogSnag