Skip to content

Instantly share code, notes, and snippets.

@avdata99
Created January 23, 2016 11:28
Show Gist options
  • Save avdata99/0e508142f9a69a566dda to your computer and use it in GitHub Desktop.
Save avdata99/0e508142f9a69a566dda to your computer and use it in GitHub Desktop.
Testing itertools product
# combinaciones de lk - xcvb - op - ghjk
p0 = ['l', 'k']
p1 = ['x', 'c', 'v', 'b']
p2 = ['o', 'p']
p3 = ['g','h','j','k']
c = 0
for l0 in p0:
for l1 in p1:
for l2 in p2:
for l3 in p3:
c += 1
print '{} {}{}{}{}'.format(c, l0, l1, l2, l3)
import itertools
prod = itertools.product('lk', 'xcvb', 'op', 'ghjk')
c = 0
for p in prod:
c += 1
print '{} {}'.format(c, str(p))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment