Advertisement
here2share

# b_combinations_with_replacement.py

Dec 6th, 2021
760
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  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'''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement