On Tue, Sep 22, 2009 at 9:13 AM, Ali Sina <seena_...@yahoo.com> wrote:

>  But it prints every number with the string 'heads'. I'm really blank at
> this. It may have something to do with the 'random' module.
>
> You could use the choice function on random.
Given a list, the choice function returns a random element of that list.

from random import choice

print choice([1,2,3,4])
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to