Cumulative Rainfall Problem¶
Your job is to monitor the rainfall 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.