Snippets

Willy Pillow Python Cards Generator

Created by Willy Pillow
cards = int(raw_input("Cards:"))
maxNo = 2 ** cards # This is actually [Max Number]+1
mask = 1 # Mask for bitwise "and" to filter the last bit
output = []

# Init output
for i in range(0, cards):
    output.append([])

for i in range(1, maxNo):
    num = i
    for j in range(0, cards):
        if num & mask == 1:
            output[j].append(i)
        num >>= 1

print output

Comments (1)

  1. kurki epst

    In order to learn about frequency bands in nb-iot technology, I found this site, where this topic is explained in an accessible and high-quality way - nb-iot frequency bands . I advise you to visit this site as well, because you can also learn a lot of useful information on a lot of cool topics! Goodbye.

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.