Re: [Tutor] Initialising attributes with random values

2005-07-05 Thread Pujo Aji
use : random.randint(1,5) so complete code will be: class something: def __init__(self, name): self.name = name self.size = random.randint(1,5) self.strength = random.randint(1,5) pujo On 7/5/05, Max Russell <[EMAIL PROTECTED]> wrote: > Hello there; > > If I hav

[Tutor] Initialising attributes with random values

2005-07-05 Thread Max Russell
Hello there; If I have a class and want to initalise it, with random values assigned to the attributes, what is the best way of doing this? For example: def __init__(self, name, size = 0, strength = 0): self.name = name self.size = size self.strength = strength start