Google News
logo
Python Program to Create a Dictionary
In the following example of Python program that creates a dictionary :
Program :
# create a dictionary using curly braces {}
person = {'name': 'John', 'age': 30, 'gender': 'Male'}

# print the dictionary
print(person)
Output :
{'name': 'John', 'age': 30, 'gender': 'Male'}
In the above example, we use curly braces to create a dictionary called `person`. The keys and values are separated by colons, and the key-value pairs are separated by commas. We can access the values of the dictionary using the keys.