For part of a project, I want the user to be able to choose a number between 1 and 7, and for there to be as many for loops as the number they entered. If they choose two, it would be the following: for i in range(0,5): row=[] for j in range(0,5): if i+j<=7: row.append(multivariate_hypergeom.pmf([i,j, 7-i-j], [4, 4, 52], 7)) m1.append(row) The option I've come up with is to do all 7 cases, but could there be a more optimal option? Continue reading...