Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # seq_combos.py
- def perm(l, n, str_a):
- if len(str_a) == n:
- print str_a
- else:
- for c in l:
- perm(l, n, str_a+c)
- perm("ABC", 3, "")
- ### >>> AAA AAB AAC ABA ABB ABC ACA ACB ACC BAA BAB BAC BBA BBB BBC BCA BCB BCC CAA CAB CAC CBA CBB CBC CCA CCB CCC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement