You can create a combination by randomly selecting a number of replacements (1,2 or 3), then select that number of distinct values and random letters. Use zip to create a mapping of values to replace with the selected letters and use the mapping to form the combination tuple. Add it to C and loop until you have the desired number of combinations in C:
A=[1,2,3,4,5,6,7]
B=['a','b','c','d','e','f','g','h','i','j','k','l']
C=[]
import random
while len(C)<10: # use the number of combinations you need
count = random.randint(1,3) # how many replacements
values = random.sample(A,count) # select values to replace
letters = random.choices(B,k=count) # select letters
repl = dict(zip(values,letters)) # replacement mapping
combo = tuple(repl.get(i,i) for i in A) # combination tuple
C.append(combo) # add combination
print(*C,sep="\n")
('a', 2, 3, 'j', 5, 'c', 7)
('g', 2, 3, 4, 5, 'd', 'f')
(1, 'f', 'g', 4, 5, 6, 'e')
(1, 2, 3, 'c', 'g', 6, 7)
(1, 2, 'j', 4, 5, 6, 7)
(1, 2, 3, 4, 5, 6, 'l')
(1, 2, 'i', 'e', 'f', 6, 7)
(1, 2, 3, 4, 5, 'l', 7)
('c', 2, 3, 4, 5, 6, 7)
('h', 2, 3, 4, 5, 6, 7)
If you need the combinations to be distinct, use a set for C instead of a list
If you want all possible combinations in C
, you can generate them using product() and combinations() from itertools:
A=[1,2,3,4,5,6,7]
B=['a','b','c','d','e','f','g','h','i','j','k','l']
C=[]
from itertools import product,combinations
for count in (1,2,3):
for positions in combinations(range(len(A)),count):
for letters in product(B,repeat=count):
combo = A.copy()
for p,c in zip(positions,letters):
combo[p] = c
C.append(tuple(combo))
output:
print(len(C)) # 63588
print(C)
[('a', 2, 3, 4, 5, 6, 7),
('b', 2, 3, 4, 5, 6, 7),
('c', 2, 3, 4, 5, 6, 7),
...
(1, 2, 3, 4, 'l', 'l', 'j'),
(1, 2, 3, 4, 'l', 'l', 'k'),
(1, 2, 3, 4, 'l', 'l', 'l')]]