List Comprehension (Python)
EasyFill in the blanks to build a list of squares of even numbers from 0 to 9.
squares = [n 2 for n in range(10) n % 2 == 0] print(squares) # [0, 4, 16, 36, 64]
Need a hint?
Exponent operator, then the filtering keyword.
Fill in the blanks to build a list of squares of even numbers from 0 to 9.
squares = [n 2 for n in range(10) n % 2 == 0] print(squares) # [0, 4, 16, 36, 64]
Exponent operator, then the filtering keyword.