pythonnumpy
Ben Gorman

Ben Gorman

Life's a garden. Dig it.

Your job is to monitor the rainfall :cloud_rain: in a region that you've broken into a 3x4 grid. Every time a storm comes, if a cell in the grid gets rain, you record it. At the end of a month you have the following two arrays of data.

import numpy as np
 
rain_locations = np.array([
    [2,3],
    [0,1],
    [2,2],
    [2,3],
    [1,1],
    [2,3],
    [1,1]
])
 
rain_amounts = np.array([0.5,1.1,0.2,0.9,1.3,0.4,2.0])

Build a 3x4 array representing the total accumulated rainfall in each cell of the grid.


Solution

This content is gated

Subscribe to one of the products below to gain access