Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python filter

ages = [5, 12, 17, 18, 24, 32]
def myFunc(x):
  if x < 18:
    return False
  else:
    return True
  
adults = filter(myFunc, ages)
for x in adults:
  print(x)     		# 18 24 32
Source by websitesetup.org #
 
PREVIOUS NEXT
Tagged: #python #filter
ADD COMMENT
Topic
Name
2+3 =