Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Dictionary Functions and Operations - Python Programming

Rating
-
Sold
-
Pages
1
Uploaded on
06-05-2026
Written in
2025/2026

Contains the definition and syntax for the functions and operations of Dictionary type in Python.

Institution
Course

Content preview

PYTHON NOTES JEGAN K K
DICTIONARY IN PYTHON:
Dictionary in python is used in many forms namely for creating adjacency list for nodes/vertices in a
graph implementation and for json data loading in python.

It is a combination of keys and values.

Syntax = py_dict = dict() # for creating empty dictionary

py-dict = {1: 'Apple', 2: 'Mango'}

In the above example 1 & 2 are the keys and 'Apple' & 'Mango' are the respective values.



KEYS() - To get the keys alone from a dict we use keys() function.
Syntax => py_dict.keys()

VALUES() - To get the key’s corresponding value from python dictionary we use values() function.
Syntax => py_dict.values()

In certain scenario, if we need to convert a list of lists to a dictionary, the list must contain key and
value pairs respectively. So if there are more than 2 values in the sublists, it becomes invalid to pack
values in a dictionary.

Syntax => a = [[1,'Apple'], [2,'Mango']] # list of lists

py_dict = dict(a) # converted dict from list of list



ADDING ITEMS TO DICT:
a = dict()
a['Item1'] = 'Box' # {'Item1' : 'Box'}

To add new value and their key to a dictionary, the key is to be present inside the '[]' brackets like
dict[key] = value.



DELETING FROM DICTIONARY:
Syntax => del a[key]

To delete a key and its pair value, the del keyword along with the dict_name followed by [key] is used
respectively.

Written for

Course

Document information

Uploaded on
May 6, 2026
Number of pages
1
Written in
2025/2026
Type
Class notes
Professor(s)
Jegan k k
Contains
Dictionary - functions and operations - python

Subjects

$3.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
jegan

Get to know the seller

Seller avatar
jegan Self Employed
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 day
Number of followers
0
Documents
2
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions