#simulate N rolls of a pair of standard dice #and tabulate the number of times each roll occurs. from pylab import * def dice(N): d={} #Python dictionary for j in range(N): x=tuple(choice(arange(1,7),2)) #need tuples to index dictionaries if x in d: d[x]+=1 else: d[x]=1 for j in arange(1,7): for k in arange(1,7): y=(j,k) print(y,':',d[y])