import numpy as np
import pandas as pd
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'))
#print(four_dice_df.Total.value_counts().sort_index(ascending=True))
print(four_dice_df[four_dice_df["Total"]==15])
Related links Catalog Mac M1
No7Chapitre Contrôle du cadre(