Post

Day 25 of 100 Days of Python

Practising DSA

Today, I started Hash Tables (or built-in dictionaries in Python).

1
2
3
4
5
6
7
8
9
10
phonebook = {
    "Alice": "98765-43210",
    "Bob": "87654-32109"
}

phonebook["Charlie"] = "76543-21098"
bob_number = phonebook["Bob"]

print(bob_number)
print(phonebook)

Output:

1
2
87654-32109
{'Alice': '98765-43210', 'Bob': '87654-32109', 'Charlie': '76543-21098'}
This post is licensed under CC BY 4.0 by the author.

Trending Tags