Last active
March 11, 2021 04:55
-
-
Save studiawan/6546156 to your computer and use it in GitHub Desktop.
Python list declaration, initialization, append and remove elements
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
# declaration without elements | |
courses = [] | |
# declaration with elements | |
languages = ['python', 'java', 'c'] | |
print(languages) | |
# fill the list | |
courses.append('progjar') | |
courses.append('j2ee') | |
courses.append(2013) | |
print(courses) | |
# remove specific element by element | |
courses.remove('j2ee') | |
print(courses) | |
# remove specific element by index | |
del courses[0] | |
print(courses) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment