mercredi 25 novembre 2015

Object Classes and Random Variables

I am writing a Dog class such that each dog object created contains height and weight field variables. Each of these should be initialized randomly for every dog. Height should be initialized to a random float in the range [1.00,100.0]cm. Weight should be initialized randomly in the range [0.7,20]kg. I have this, but it won't output. What am I doing worng

class Dog: import random

def_init_(self,heihgt,weight):
    self.height = height
    self.weight = weight

    r = random.random()
    a = dog(0.0,101.0)
    b = dog(0.6,21.0)




Aucun commentaire:

Enregistrer un commentaire