Complete the code to create a pixel grid with 3 rows and 3 columns.
pixels = [[0 for _ in range([1])] for _ in range(3)]
The code creates a 3x3 grid representing pixels. The inner loop runs 3 times to create 3 columns.
Complete the code to calculate the total number of pixels in an image with width 1920 and height 1080.
total_pixels = 1920 [1] 1080
Total pixels in an image is width multiplied by height.
Fix the error in the code to access the pixel at row 2, column 3 in a 2D pixel list.
pixel_value = pixels[[1]][2]
Indexing starts at 0, so row 2 is index 1.
Fill both blanks to create a dictionary comprehension that maps pixel coordinates to their brightness if brightness is greater than 100.
bright_pixels = {(x, y): pixels[x][y] for x in range([1]) for y in range([2]) if pixels[x][y] > 100}The comprehension loops over height (rows) for x and width (columns) for y to check each pixel's brightness.
Fill all three blanks to create a dictionary that stores pixel brightness for pixels with brightness above 150.
bright_pixels = { [1]: pixels[[2]][[3]] for [2] in range(height) for [3] in range(width) if pixels[[2]][[3]] > 150 }The dictionary uses (x, y) tuples as keys and loops over height and width for coordinates.