×

Python Tutorial

Python Basics

Python I/O

Python Operators

Python Conditions & Controls

Python Functions

Python Strings

Python Modules

Python Lists

Python OOPs

Python Arrays

Python Dictionary

Python Sets

Python Tuples

Python Exception Handling

Python NumPy

Python Pandas

Python File Handling

Python WebSocket

Python GUI Programming

Python Image Processing

Python Miscellaneous

Python Practice

Python Programs

Python program to create an empty dictionary

Here, we are going to learn how to create an empty dictionary in Python? By Shivang Yadav Last updated : September 17, 2023

In Python programming language, a dictionary is a collection of an unordered collection of data values in the form of key-value pair.

Creating an empty dictionary using {}

An empty dictionary can be created by using the curly braces ({}) without assigning any values.

Syntax

dictionary_name = {}

Program

# Python program to create an empty dictionary

# creating an empty dictionary
dict_a = {}

# printing the dictionary
print("dict_a :", dict_a)

# printing the length
print("Total elements: ", len(dict_a))

Output:

dict_a : {}
Total elements:  0

Creating an empty dictionary using the dict() method

The dict() method is used to create a dictionary, it can also be used to create an empty dictionary.

Syntax

dictionary_name = dict()

Program

# Python program to create an empty dictionary

# creating an empty dictionary
dict_a = dict()

# printing the dictionary
print("dict_a :", dict_a)

# printing the length
print("Total elements: ", len(dict_a))

Output:

dict_a : {}
Total elements:  0

Python Dictionary Programs »

Advertisement
Advertisement

Related Programs

Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2025 www.includehelp.com. All rights reserved.