python itertools product repeat to big
问题 I'm trying to make a python script to calculate some win/loss chances. to do this i'm trying to get all possible combinations off wins and losses (K is the number of wins needed to win the game): for combination in itertools.product(['W','L'], repeat=(K*2)-1): if ((combination.count('L') < K) and (combination.count('W') == K)): #calculate the chance of this situation happening for some reason this works fine, until the repeat becomes to big (for instance if K=25) Can someone give me some