I would like to have all possible combinations of lists of a given size. 
Lets say for example, I have a given list K, such as K = [3, 5, 2]. With the following code I get what I desire. But how do I generalize this for any list of a given size, without just adding for loops? 
assignment= []
for l in range(K[0]):
    for m in range(K[1]):
        for n in range(K[2]):
            a = [l,m,n]
            assignment.append(a)
 
    