I have this list:
colors = [\"R\", \"G\", \"B\", \"Y\"]
and I want to get 4 random letters from it, but including repetition.
Runni
With random.choice:
print([random.choice(colors) for _ in colors])
If the number of values you need does not correspond to the number of values in the list, then use range:
print([random.choice(colors) for _ in range(7)])
From Python 3.6 onwards you can also use random.choices (plural) and specify the number of values you need as the k argument.