dict()
` constructor to create a dictionary :# create a dictionary using dict() constructor
my_dict = dict(name='John', age=32, city='New York')
# print the dictionary
print(my_dict)
{'name': 'John', 'age': 32, 'city': 'New York'}
my_dict
` using the `dict()
` constructor. We pass in the key-value pairs separated by commas and `dict()
` method converts them into a dictionary object. We then print the contents of the dictionary using the `print()
` function.