I am trying to write a function that generates a random sequence of letters (letters from a list), and the sequence length is K (K is passed to the function as an argument when function is called). I am stuck, and I don't understand how to generate random sequence of letters.
            Asked
            
        
        
            Active
            
        
            Viewed 142 times
        
    1 Answers
-1
            
            
        As mentioned by we can loop the random choice on the given list for k times to get the desired output
Def fn(letters,k):
     return [np.random.choice(letters) for _ range(k) ]]
 
    
    
        Venkatachalam
        
- 16,288
- 9
- 49
- 77
