Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

List comprehensions

numbers = [1, 2, 3, 4, 5, 6, 7, 8]

even_numbers = [number for number in numbers if number % 2 == 0]

print(even_numbers)  # [2, 4, 6, 8]
Source by www.codecademy.com #
 
PREVIOUS NEXT
Tagged: #List #comprehensions
ADD COMMENT
Topic
Name
8+3 =