The basic approach I use in these sorts of problems is to generate the choices, remove them from a list as they are asked, and then stop when this list is empty.
If you don't need the list of questions afterwards, this will work: from random import choice questions = [ [i,j] for i in range(1,10) for j in range(1,10) ] false_answers = [] while questions: q = choice(questions) del questions[questions.index(q)] # stuff If you'd like to keep the original question list, make a proxy list, and choose from that: questions = [ [i,j] for i in range(1,10) for j in range(1,10) ] false_answers = [] choices = range(len(questions)) while choices: proxyq = choice(choics) del choices[choices.index(proxyq)] q = questions[proxyq] # stuff Cheers _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
