I was reading this article
In there was this example
from itertools import combinations teams = ["Packers", "49ers", "Ravens", "Patriots"] for game in combinations(teams, 2): print game >>> ('Packers', '49ers') >>> ('Packers', 'Ravens') >>> ('Packers', 'Patriots') >>> ('49ers', 'Ravens') >>> ('49ers', 'Patriots') >>> ('Ravens', 'Patriots')
So I thought I would play with it. very simply just used numbers to create a bigger list and a bigger tuple.
>>> from itertools import combinations >>> numbers = [1,2,3,4,5,6,7,8,9,10] >>> for game in combinations(numbers, 6): print game
When I received more combinations than I expected I wondered how many combinations had I received.
>>> len(game) 6
So length only returns the length of one game. How do I find out how many tuples were created by combinations.
Edited by flebber