pythonnumpy
Ben Gorman

Ben Gorman

Life's a garden. Dig it.

Eager to make your mark on the PTA, you decide the best way to hide eggs for the upcoming Easter egg hunt is to use NumPy :material-egg-easter:. You represent the field as a 10x10 array of 0s.

import numpy as np
 
field = np.zeros(shape = (10, 10))
 
print(field)
# [[0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
#  [0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
#  [0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
#  [0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
#  [0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
#  [0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
#  [0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
#  [0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
#  [0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
#  [0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]]

Insert 20 random normal values at random (non repeating) locations in the grid. Then you'll know how much candy to hide at each spot.


Solution

This content is gated

Subscribe to one of the products below to gain access