Skip to content

Instantly share code, notes, and snippets.

@studiawan
Last active March 11, 2021 04:55
Show Gist options
  • Save studiawan/6546156 to your computer and use it in GitHub Desktop.
Save studiawan/6546156 to your computer and use it in GitHub Desktop.
Python list declaration, initialization, append and remove elements
# 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