Question: Help needed with Python question! Thank you! Next, modify the code below to add a value of 4 to the array if, when the location
Help needed with Python question! Thank you!

Next, modify the code below to add a value of 4 to the array if, when the location in the array is chosen randomly, the location falls inside of the square you just drew. Specifically read about np.random.randint, which is used to generate random integers find two random integers in the right ranges use if to see if the chosen point is inside the square, if outside, change the value in the array to 3 if inside the square, change the value in the array to 2 . do not change the square itself. for step in range(20): # generate a random Location in the array using # integer random numbers rand_row = np.random.randint(size_1) rand_col = .... ### # check to see whether this new point is inside or outside of the box if (rand_row > 5) and (rand_row 5) and (rand_col) 5) and (rand_row 5) and (rand_col)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
