Advertisement
here2share

# seq_combos.py

Apr 24th, 2017
1,197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. # seq_combos.py
  2.  
  3. def perm(l, n, str_a):
  4.     if len(str_a) == n:
  5.         print str_a
  6.     else:
  7.         for c in l:
  8.             perm(l, n, str_a+c)
  9.  
  10. perm("ABC", 3, "")
  11.  
  12. ### >>> 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