Learn Before
Concept

Dictionary

• Dictionary is a built-in data structure. A dictionary is an ordered and mutable collection of objects. • It consists of Key-Value pairs. Each Key must be Unique.

Syntax:

dictionary = {"key name": value}
student_scores = { "John" : 76, "Peter": 95, "Mike": 84 }

We can access the Values using the Keys:

print(student_scores["John"])

This python print() statement would print out the value 76. It is also important to note that keys must map to a unique value.

0

1

Updated 2021-05-20

Tags

Python Programming Language

Data Science

Related