Question: Must be answered in one line using np.where for numpy arrays. Thank you! def where(scores): 4. Madison wants to create a simple visual based
Must be answered in one line using np.where for numpy arrays. Thank you!
def where(scores): """ 4. Madison wants to create a simple visual based on how happy she is after each game. Replace the days where she earns from [-infinity, 9) points with a ':(', the days where she earns [10, 19) points with ':)', and the days where she earns [20, infinity) points with ':D'. Return this array.
Args: scores (array): the array that represent's Madison's points per game over several weeks
Returns: nd.array with Madison's scores replaced by various amounts of dollar signs
>>> scores = np.array([[20, 15, 28, 3, 15], [24, 6, 32, 27, 22]]) >>> where(scores) array([[':D', ':)', ':D', ':(', ':)'], [':D', ':(', ':D', ':D', ':D']], dtype=' """ pass
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
