[Tutor] Random module help

Alan Gauld alan.gauld at btinternet.com
Sat Oct 6 13:45:49 CEST 2007


"Norman Khine" <norman at khine.net> wrote

> But what I was wondering if possible in achieving is that my 
> questions
> set (q) contains questions that are similar, i.e. they are written 
> in
> different ways, so I wanted to get the random set of unique 
> questions
> rather then have variations of the same question returned in my set.

It sounds like maybe you need a list of questions against the keys.
That way you can select one of the list of similar questons at
random whenever that key is chosen.

{'q1': ['What is you name?', 'who are you?', 'what are you called?'],
 'q2': ["What's your address?", 'Where do you live?'],
 q3: [ etc....]
}

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list