There are 3 solutions (and probably 100 more):
- The"classic" - formethod appending everyone of the- N=4letters to the same string and the- choicemethod of the- randommodule that picks one element among its arguments,
 
- Using the - join- methodto add in one time the elements generated by the- choicesmethod of the- randommodule. The- choicesmethod is very versatile and can be used with several arguments (official documentation),
 
- Using the - join- methodto add in one time the elements generated by the- samplemethod of the- randommodule. The- sample(set,num)method picks randomly- numelements in- set.
 
import random
N=4
source_string = 'ABCDEF
Method1
random_string_1=""
for it in range(0,N):
    random_string_1 = random_string_1 + random.choice(source_string)
Method2
random_string_2 = "".join(random.choices(source_string, weights=None, 
cum_weights=None, k=N))
Method3
random_string_3 = "".join(random.sample(source_string, N))