Dictionary In Python
1. DICTIONARY 101
1.1. Defining a Dictionary
user_car ={'make': 'honda','model': 'fit','year': 2015}1.2. Accessing Values in a Dictionary
print(user_car['make'].title())
print(user_car['model'].title())1.3 Adding New Key-Value Pairs
1.4. Starting with an Empty Dictionary
1.5. Modifying Values in a Dictionary
1.6. Removing Key-Value Pairs
1.7. A Dictionary of Similar Objects
2. LOOPING THROUGH A DICTIONARY
2.1. Looping Through all Key-Value Pairs
a. Example 1:
b. Example 2:
2.2. Looping Through all the Keys
a. Looping with if statement
b. Looping through keys in order
2.3. Looping Through All Values
a. Looping through values without repetition
3. NESTING
3.1. A List of Dictionaries
3.2. A List in a Dictionary
a. One object, multiple information
b. Refining the code
3.3. A Dictionary in a Dictionary
Last updated