In this tutorial we are going to learn :
- Dictionaries In Python
- Creating Items and Accessing Items
- Change Dictionary Items
- Checking Items and Getting Lenght
Dictionaries in Python
Dictionary is an unordered, changeable, and indexed collection of items.
- Dictionaries have key and value.
- They are written with curly brackets
Creating Items and Accessing Items
We use curly brackets to create a dictionary.
- We also use the dict() method to create a dictionary.
- To access items in a dictionary, you can use the get() method.
Change Dictionary Items
We can also change the value of a specific item by referring to its key name.
Checking Items and Getting Lenght
We can use the in keyword to learn if the item exists in dictionary.
To get length of a dictionary , you can use the len() method.