Methods and Functions

Python Dictionary Items () 

A dictionary in Python is an unordered collection of items. As in a real-life dictionary, each word is associated with its meaning, in the Python dictionary, each key is paired with its respective value. Thus, the data in the dictionary is stored in pairs of key and value. 

Syntax to create a dictionary: name of dictionary = {key:value}



The items, that is, the data that is stored in the dictionary are unordered and mutable. Thus, they can be changed after the creation of the dictionary. However, the items cannot be duplicated within the same dictionary. These items can be of any data type, including numeric and characters such as integers, strings, floats, complex numbers. Boolean type, etc.   

Items () Parameters 

The items () method in the dictionary is used to return each item in a dictionary as tuples in a list. Thus, the dictionary key and value pairs will be returned in the form of a list of tuple pairs. 

Syntax of items () method: dictionary_name.items ()

The items () method does not take any parameters. 

Return Value from items ()

When you use the items () method on a dictionary, the key and value pair stored in it will be displayed in the form of tuples in a list. Note that the returned list is a view of the items stored in the dictionary. The method does not change a dictionary into a list. Also, all the changes that will be done in the dictionary will be shown in the list view as well. 



Example 1: Get all items of a dictionary with items ()


my_dict = {“fruit”: “apple”, “vegetable”: “potato”, “price”: 60} 

x = my_dict.items ()

print (x)



dict_items ([(‘fruit’, ‘apple’), (‘vegetable’, ‘potato’), (‘price’, 60)])

Example 2: How items () works when a dictionary is modified?


my_dict = {“fruit”: “apple”, “vegetable”: “potato”, “price”: 60} 

x = my_dict.items ()

print (x)

my_dict [“price”] = 70

print (x)



dict_items ([(‘fruit’, ‘apple’), (‘vegetable’, ‘potato’), (‘price’, 60)])

dict_items ([(‘fruit’, ‘apple’), (‘vegetable’, ‘potato’), (‘price’, 70)])


FAQs on Python Dictionary Items

1. What is another word for items?

Answer: Items in a dictionary are also known as the values that are stored in the dictionary in the form of key: value. They can be of any data type.

2. What is an example of an item?

Answer: An item of a dictionary should be in the syntax of key: value, that is, the key and its corresponding value should be separated by a colon. 

Here is an example of an item in the dictionary: {“city”: “New York”}

This will be preceded by the name of the dictionary, as per the syntax followed for them. 

3. What is the meaning of an item?

Answer: An item is data that is stored in the dictionary in the pair of keys: value. The data stored does not have any order and can be changed but not duplicated. 

4. What are computer items?

Answer: Each value or element stored in a data structure is referred to as an item. It can be the data stored in a list, a dictionary, a tuple, and other Python data structures.

Share with friends

Customize your course in 30 seconds

Which class are you in?
Get ready for all-new Live Classes!
Now learn Live with India's best teachers. Join courses with the best schedule and enjoy fun and interactive classes.
Ashhar Firdausi
IIT Roorkee
Dr. Nazma Shaik
Gaurav Tiwari
Get Started

Leave a Reply

Your email address will not be published. Required fields are marked *

Download the App

Watch lectures, practise questions and take tests on the go.

Customize your course in 30 seconds

No thanks.