Update README.md

Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
This commit is contained in:
David Rotermund 2023-12-11 09:59:46 +01:00 committed by GitHub
parent eaf9aa752f
commit 6d1c2e258c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -114,7 +114,7 @@ print(collection_of_strings) # -> ['MM', 'NN', 'OO', 'PP', 'EE', 'FF', 'GG', 'H
## List functions
# [len()](https://docs.python.org/3/library/functions.html#len) and [sorted()](https://docs.python.org/3/library/functions.html#sorted)
### [len()](https://docs.python.org/3/library/functions.html#len) and [sorted()](https://docs.python.org/3/library/functions.html#sorted)
```python
@ -141,3 +141,31 @@ primes = [2, 3, 5, 7]
print(sum(primes)) # -> 17
print(max(primes)) # -> 7
```
### [append()](), [pop()](), and [remove()]()
```python
collection_of_strings = [
"AA",
"BB",
"BB",
"CC",
"DD",
"EE",
"FF",
"GG",
"HH",
]
collection_of_strings.append("II")
print(
collection_of_strings
) # -> ['AA', 'BB', 'BB', 'CC', 'DD', 'EE', 'FF', 'GG', 'HH', 'II']
print(collection_of_strings.pop()) # -> II
print(
collection_of_strings
) # -> ['AA', 'BB', 'BB', 'CC', 'DD', 'EE', 'FF', 'GG', 'HH']
collection_of_strings.remove("BB")
print(collection_of_strings) # -> ['AA', 'BB', 'CC', 'DD', 'EE', 'FF', 'GG', 'HH']
```