Programme chap4_classe_1964_.py


# coding: latin-1
class piece_normale :
    def tirage (self) :
        return random.randint (0,1)

    def cent_tirages (self) :
        s = 0
        for i in range (0,100) : s += self.tirage ()
        return s

class piece_truquee (piece_normale) :
    def tirage (self) :
        t = random.randint (0,10)
        if t >= 3 : return 1
        else : return 0

p  = piece_normale ()
print p.cent_tirages ()
p2 = piece_truquee ()
print p2.cent_tirages ()

créé avec py2html version:0.62