Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python List Comprehension

fruits = ["apple", "banana", "cherry", "kiwi", "mango"]
newlist = []

for x in fruits:
  if "a" in x:
    newlist.append(x)

print(newlist)
Source by courses.bootcampspot.com #
 
PREVIOUS NEXT
Tagged: #Python #List #Comprehension
ADD COMMENT
Topic
Name
7+2 =