[Tutor] Random module help

Norman Khine norman at khine.net
Sun Oct 7 09:25:11 CEST 2007


Thank you, this is great.

Alan Gauld wrote:
> "Norman Khine" <norman at khine.net> wrote 
> 
> 
>> q_keys.sort()
>> a = [q[x] for x in q_keys]
> 
> a = [random.choice(q[x]) for x in q_keys]
> 
>> So from this how do I choose a random element and produce a new 
>> dictionary like for example:
> 
> See above.
> 
> 

-- 
Norman



More information about the Tutor mailing list