Dictionary Handling in Python – Notes


By Anjeev Kr Singh – Computer Science Educator
Published on : May 5, 2021 | Updated on : November 24, 2022

Dictionary Handling in Python


Topics

Dictionary: introduction, accessing items in a dictionary using keys, mutability of dictionary (adding a new item, modifying an existing item), traversing a dictionary, built-in functions: len(), dict(), keys(), values(), items(), get(), update(), del(), clear(), fromkeys(), copy(), pop(), popitem(), setdefault(), max(), min(), count(), sorted(), copy();

Suggested programs : count the number of times a character appears in a given string using a dictionary, create a dictionary with names of employees, their salary and access them


What is Dictionary ?

Accessing items in a dictionary using keys

Mutability of dictionary :-

a) Adding a new item,

b) Modifying an existing item)

Traversing a dictionary

Built-in functions:

len(),

dict(),

keys(),

values(),

items(),

get(),

update(),

del(),

clear(),

fromkeys(),

copy(),

pop(),

popitem(),

setdefault(),

max(),

min(),

count(),

sorted(),

copy();

Suggested programs :

1. Count the number of times a character appears in a given string using a dictionary.

2. create a dictionary with the names of employees, and their salaries and access them.

About the Author

Anjeev Kr Singh

Anjeev Kr Singh

Computer Science Educator, Author, and HOD. Guiding CBSE students in CS, IP, IT, WA & AI via mycstutorial.in. Creator of Question Bank for Class 10 & 12 students.

You cannot copy content of this page

Scroll to Top