Simpson Function


In [2]:
def simpsongender(hair, weight, age):
    if weight >= 160:
        return 'M'

In [3]:
simpsongender(8, 290, 38)


Out[3]:
'M'

In [4]:
def iris(petallength, petalwidth):
    if petalwidth <= .08:
        if petalwidth <= 1.75 and petallength <= 4.95:
            if petalwidth <= 1.65:
                return 'class2'
            else:
                return 'class3'
        else:
            return 'class3'
    else:
        return 'class1'

In [7]:
iris(1.7,  .02)


Out[7]:
'class2'

In [ ]: