FunctionRacerProblemsRace

Black and White

BeginnerNumPyPython

img is a 2-D array of grayscale pixels from 0 to 255. Return a new array of the same shape in which every pixel that is at least cutoff becomes 255 and every other pixel becomes 0.

Example 1

img [[10,200],[128,127]]
cutoff 128
returns [[0,255],[255,0]]

200 and 128 reach the cutoff; 10 and 127 do not.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More NumPy problems