All problems
Percentage of White Pixels
Problem
Compute the percentage of pixels that are strictly greater than threshold.
Return the percentage rounded to 2 decimal places. The image is non-empty.
Test cases
case 1
in: [[[0,255],[255,255]],127]
expected: 75
case 2
in: [[[0,127]],127]
expected: 0
case 3
in: [[[255,255,0]],0]
expected: 66.67
case 4
in: [[[0,0,255]],127]
expected: 33.33
Starter codePython
def white_percentage(image, threshold):
# Your code here
pass4 test cases · run your code against them in the editor