Skip to content

Commit da7f093

Browse files
authored
add cheat for removing list value with pop
1 parent aff7f69 commit da7f093

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,25 @@ If the value appears multiple times in the list, only the first instance of the
13211321

13221322
[_Return to the Top_](#python-cheatsheet)
13231323

1324+
1325+
### Removing Values from Lists with pop()
1326+
1327+
```python
1328+
>>> spam = ['cat', 'bat', 'rat', 'elephant']
1329+
1330+
>>> spam.pop()
1331+
1332+
>>> spam
1333+
['cat', 'bat', 'rat']
1334+
1335+
>>> spam.pop(0)
1336+
1337+
>>> spam
1338+
['bat', 'rat']
1339+
```
1340+
1341+
[_Return to the Top_](#python-cheatsheet)
1342+
13241343
### Sorting the Values in a List with the sort() Method
13251344

13261345
```python

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy