Pastebin

Paste #1276: generate_draws()

< previous paste - next paste>

Pasted by Flawless

Download View as text

def generate_draws():
    # Generate all combinations of 7 numbers
    possible_draws = []
    t = [0]*16
    for x in range(2**16):
        ones = 0
        for y in range(16):
            t[15-y] = (x & (1 << y)) >> y
            ones += t[15-y]
        if ones == 7:
            possible_draws.append(list(t))
    return possible_draws


print generate_draws()

New Paste


Do not write anything in this field if you're a human.

Go to most recent paste.