In [9]:
comic={
"hairlength" : 8,
"weight" : 290,
"age" : 39
}
def simpson(d):
if 0 < d['weight'] <= 160:
d['class'] = "female"
return "female"
elif d['weight'] > 160:
d['class'] = "male"
return "male"
else:
return "You're entering the wrong weight, try again!"
In [11]:
simpson(comic)
comic['class']
Out[11]:
In [ ]: