Hello David!

On Wednesday February 3 2010 04:21:56 David wrote:
> 
> import random
> terms =  []
> for i in range(2):
>       terms = random.randint(1, 99)
> print terms

Here is an other solution, which is quite easy to understand and short:

import random
terms =  []
for i in range(2):
    terms += [random.randint(1, 99)]
print terms


Note the rectangular brackets around "[random.randint(1, 99)]". This creates a 
list which a single number in it. This small list can then be added to the 
already existing list "terms".


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

Reply via email to