Dictionary is an unordered collection of key-value pairs. It is generally used when we have a huge amount of data. Dictionaries are optimized for retrieving data. We must know the key to retrieve the value.
In Python, dictionaries are defined within braces {} with each item being a pair in the form key: value. Key and value can be of any type.
In this Example OS,RAM,CPU are Key, Fedora,Delight Dell are Values
1. Accessing a Value
To access a value, you mention the key in square brackets.
2. Reassigning Elements
You can reassign a value to a key.
Difference between List, Tuples and dictionary
No comments:
Post a Comment