Class 11 Python Dictionary Notes covers Dictionary Methods, Traversing Dictionary, Adding and Modifying Dictionary Elements with examples. This Dictionary in Python Class 11 Notes is prepared for all students of Class 11 Computer Science to understand each concept easily and get highest marks. This Dictionary Class 11 Notes is written very concisely as per CBSE suggested Syllabus.
Contents
What is Dictionary
- Dictionaries are unordered collection of items falls under mapping.
- Stores data in form of key:value pair called item.
- Key is separated from its value by colon ‘:’ and items are separated by comma.
- All items of dictionaries are enclosed in curly bracket ‘{}’.
- The keys in the dictionary must be unique and should be of immutable data type.
- The value can be repeated and of any data type.
Creating a Dictionary
Accessing items in a Dictionary
- Items of dictionary are accessed using keys.
- Each key of dictionary serve as index and maps to a value.
- If key is not present in dictionary, then we get KeyError.
Examples
Dictionary is Mutable
Yes, Dictionary is Mutable as its content can be changed after it has been created.