Source Code:
(back to article)
# Creating a dictionary with default values my_dict = dict.fromkeys(['Name', 'Age', 'City'], 'Unknown') # Adding a new element to the dictionary my_dict['Gender'] = 'Male' # Printing the updated dictionary print(my_dict)
Result:
Report an issue