Question: The code below creates a table for the outcomes when 4 dice are rolled, and stores them as a DataFrame. > four_dice = np.zeros([pow(6,4),5]) n

The code below creates a table for the outcomes when 4 dice are rolled, and stores them as a DataFrame.

>

four_dice = np.zeros([pow(6,4),5]) n = 0 outcomes = [1,2,3,4,5,6] for i in outcomes: for j in outcomes: for k in outcomes: for l in outcomes: four_dice[n,:] = [i,j,k,l,i+j+k+l] n +=1 four_dice_df = pd.DataFrame(four_dice,columns=('Dice 1','Dice 2','Dice 3','Dice 4','Total'))

>

Extend the code to compute the number of ways to obtain each unique result, i.e. the number of times each total appears. Print out the table of results ordered from lowest possible total (4) to highest possible total (24), as shown below.

The code below creates a table for the outcomes when 4 dice

Extend the code to compute the number of ways to obtain each unique result, i.e. the number of times each total appears. Print out the table of results ordered from lowest possible total (4) to highest possible total (24), as shown below. For examnle

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!