Created
October 21, 2022 15:12
-
-
Save mh0w/559aa2f10796b7e0b06dbdac9f56c073 to your computer and use it in GitHub Desktop.
lists: create, isolate, remove, clear
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mylist = ['a', 'b', 'c', 'd'] | |
# Remove item 1 | |
mylist.pop(1) #'b' | |
print(l) #['a', 'c', 'd'] | |
# Remove item with value 'd' | |
mylist.remove('d') | |
print(l) # ['a', 'c'] | |
# Clear (remove all items) | |
mylist.clear() | |
print(l) # [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment