A nested list comprehension builds a grid, and a second one counts some of its numbers. grid = [[r * c for c in range(3) if c != r] for r in range(1, 4)] print(grid, len([x for row in grid for x in row if x % 2])) What does the program print?
Log in to join the discussion.
Loading…