Technically you want a selection **which allows sequence items to be repeated,
a **combination or permutation does not:

def selections(seq, n):
"""
selections(seq, n) is a recursive generator where
seq is an iterable object
n is the sample size
n = len(seq) is the max sample size
returns a list of lists of unique sample size items
"""
if n == 0:
yield []
else:
for i in range(len(seq)):
# recursion
for ss in selections(seq, n - 1):
yield [seq[i]] + ss
# use 'ABC' or ['A', 'B', 'C']
iterable = 'ABC'
sample_size = len(iterable)
sel = list(selections(iterable, sample_size))
# show as strings
for item in sel:
s = "".join(item)
print(s)
""" my result >>>
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
"""

Is C similar to C# (C-sharp); or are they completely different ? I was wondering if I should begin learning C# and the transition to C will be a tad ...

Write a program that displays all numbers divisible by 3 and 4 within a range entered by user. Display five numbers per line. Numbers are separated by exactly two spaces. ...

Hi guys. I am trying to create a program where the user inputs an integer and the program will cout the nth prime number. Unfortunatly when I try to cout ...