[Tutor] how to print random number multiply

David Hutto smokefloat at gmail.com
Sat Jan 15 02:14:26 CET 2011


On Fri, Jan 14, 2011 at 8:01 PM, David Hutto <smokefloat at gmail.com> wrote:
> Sorry , the tab button doesn't work for text in google mail, and it
> jumped to send
>
>>>
>
>   import random
>> for x in range(1,10):
         num = random.random()
>       print (num)

this should 'bind' your variable to a knew random each time

>
> This assigns a new random each time, where as outside the for loop it
> assigns it once.
>



-- 
Sometimes...my mama...says I get over excited about technology.


More information about the Tutor mailing list