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?

Because random.random() is defined to always return a float between 0 and 1. That's what it does.

If you want a random whole number, you can call random.randint or random.randrange. See the Fine Manual for the difference between them, or at the interactive interpreter, call:

help(random.randint)
help(random.randrange)

and read what they say. Then if you still have any questions, ask.



--
Steven

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to