pythonnumpy
Ben Gorman

Ben Gorman

Life's a garden. Dig it.

You're preparing for a game show where you play the following game.

You're faced with four doors :material-door: :material-door: :material-door: :material-door:
Behind one door is cash money :money_mouth: Behind the other three doors is steaming pile of broccoli 🥦

If you pick the door with money, you get the option to play again at the risk of losing the money you've collected thus far. If you keep winning, you can play a maximum of three rounds before the game show host kicks you off his show.

You have some strategy ideas you'd like to evaluate before you go on the show. You hire an unpaid intern to scour through historic recordings of the show and log data on where prizes were located and the value of each prize.

Your intern gets back to you with the following matrices:

  • prize_doors: Here, element (i,j) identifies the door hiding the prize in the ith game of round j
  • prizes: Here (i, j) gives the prize amount in the ith game of round j
import numpy as np
 
prize_doors = np.array([
    [1, 0, 2],
    [0, 0, 1],
    [3, 3, 1],
    [1, 2, 0],
    [2, 1, 1]
])
 
prizes = np.array([
    [100, 150, 500],
    [200, 300, 250],
    [150, 100, 325],
    [425, 200, 100],
    [200, 250, 300]
])

Build a 5x3x4 matrix where (i,j,k) represents the prize behind door k of round j of game i.


Solution

This content is gated

Subscribe to one of the products below to gain access