Python program to create a dictionary

In this source code example, we will write a python program to demonstrate the creation of a dictionary in python.

Python program to create a dictionary

def dictionary1():
    # general dictionary 1
    student = {
        'name': 'Ram',
        'age': 22,
        'marks': [40, 50, 60],
        40: 40
    }
    emptyObject = {}
    print(emptyObject)
    print(student)


dictionary1()

Output:

{}
{'name': 'Ram', 'age': 22, 'marks': [40, 50, 60], 40: 40}

Comments