Skip to content

Commit a12e495

Browse files
authored
Update README.md
1 parent 645ef23 commit a12e495

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

README.md

+20-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ while(i < 10):
9292
9393
## Data Structures
9494
95-
### List
95+
### Lists
9696
```python
9797
# These are all inplace operations returns a None value
9898
@@ -110,5 +110,23 @@ while(i < 10):
110110
111111
<list>.copy() # Makes a shallow copy of the list
112112
<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
114114
```
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+

0 commit comments

Comments
 (0)