import random
def iterate_thru_list():
i = 0
L1 = [1,2,3,4,5,6,7,8,9]
L2=['a','b','c','d','e','f','g','h','i']
L3= ['A','B','C','D','E','F','G','H','I']
random.shuffle(L1)
random.shuffle(L2)
random.shuffle(L3)
print ("List:")
while i <= 5:
for x, y, z in [(x,y,z) for x in L1 for y in L2 for z in L3]:
print(x,y,z)
i = i + 1
I want to iterate through separate lists returning a randomly chosen digit or letter from each and return a 'set' in this case of three unique letters or numbers. Caution the while loop does not work - this loops until it has returned all combinations, which I do not understand either. Can I use random.choice(L1 or L2 or L3) to return x,y and z? Is there another simpler way to return a random selection from multiple lists? THank you for your help