On Fri, Jan 14, 2011 at 9:25 PM, bob gailer <bgai...@gmail.com> wrote:

>  On 1/14/2011 10:02 PM, walter weston wrote:
>
> when I print random.random() it always returns a float why is this? how do
> I change it to a whole number?
>
>
> That depends on what behavior you want.
>
> If you RTFM you will see:
>  random.random() Return the next random floating point number in the range
> [0.0, 1.0). The Python tool for converting float to integer is the int
> function.
>
> However int(random.random() ) will always return 0.
>
> In what range do you want the integers to fall?
>

The documentation in general is a fine source for learning new
functionality: http://docs.python.org/library/random.html

<http://docs.python.org/library/random.html>HTH,
Wayne
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to