Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python list remove

#original list
programming_languages = ["JavaScript", "Python", "Java", "C++"]

#print original list
print(programming_languages)

# remove the value 'JavaScript' from the list
programming_languages.remove("JavaScript")

#print updated list
print(programming_languages)

#output

#['JavaScript', 'Python', 'Java', 'C++']
#['Python', 'Java', 'C++']

programming_languages = ["JavaScript", "Python", "Java", "Python", "C++", "Python"]

programming_languages.remove("Python")

print(programming_languages)

#output
#['JavaScript', 'Java', 'Python', 'C++', 'Python']
Source by www.howtouselinux.com #
 
PREVIOUS NEXT
Tagged: #python #list #remove
ADD COMMENT
Topic
Name
7+7 =