here2share

# b_combinations_with_replacement.py

Dec 6th, 2021
544
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # b_combinations_with_replacement.py
  2.  
  3. from itertools import combinations_with_replacement
  4.  
  5. alpha = '123'
  6. for s in combinations_with_replacement(alpha, 3):
  7.     output = ''.join(s)
  8.     print output,
  9.  
  10. '''111 112 113 122 123 133 222 223 233 333'''
RAW Paste Data