Python Dictionary: Zero to Hero with Examples

Learning dictionary for data science and machine learning applications

Amit Chauhan
8 min readJul 18, 2022
Photo by Alex Chumak on Unsplash

Introduction

Python scripts or programs are generally impossible to exist without the use of lists and dictionaries. As we know, dictionaries play a huge role in indexing; we all have already been familiar with the basic concept of Dictionaries from the previous articles. But in this article, we’ll be exploring advanced methods like turning a dictionary into a list or two lists with real-life examples. So let’s have a recap…

What is a Dictionary?

Theoretically, a dictionary is to store data in key-value pairs. And these items are accessed using keys and not their positions, unlike lists. The values in a dictionary can be of any type (string, integers, floating-point numbers, etc.).

Syntax:

A dictionary is defined by an enclosed comma-separated list of key-value pairs in curly braces.

D = {(key):(value),(key):(value),(key):(value),(key):(value)}

Example:

Let’s look at an example of student roll numbers. Consider a dictionary with students’ roll numbers and their names. Practically, there might be many students with the same names. Hence it would be…

--

--