File tree 1 file changed +20
-2
lines changed
1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ while(i < 10):
92
92
93
93
# # Data Structures
94
94
95
- # ## List
95
+ # ## Lists
96
96
```python
97
97
# These are all inplace operations returns a None value
98
98
@@ -110,5 +110,23 @@ while(i < 10):
110
110
111
111
< list > .copy() # Makes a shallow copy of the list
112
112
< list > .index(< ele> ) # Returns the index of the given element
113
- < list > .count(< ele> ) # Returns the number of occurrences of the element.
113
+ < list > .count(< ele> ) # Returns the number of occurrences of the element
114
114
```
115
+ # ## Dictionaries
116
+ key- value pairs.
117
+ ```python
118
+ newDict = {' Google' :100 , ' Facebook' :80 , ' Apple' :90 }
119
+
120
+ newDict[' Amazon' ] = 85 # Adding a key along with the value
121
+
122
+ # Accessing the dictionary
123
+ for key in newDict:
124
+ print (" {key} -> {x} " .format(key = key, x = newDict[key]))
125
+
126
+ len (newDict) # Find the length of the dictionary
127
+ newDist.pop(< key> ) # Removes the item with the specified key name
128
+ newDict.copy() # Make a copy of a dictionary
129
+ ```
130
+ A dictionary can also contain many dictionaries, this is called nested dictionaries.
131
+
132
+
You can’t perform that action at this time.
0 commit comments