说明:代码研习社20189春的活动示例代码,活动说明及其他成员递交的地址:http://yun.zjer.cn/index.php?r=studio/activies/activiesdetail&sid=531&aid=9241 。
# coding:utf-8
def getAnswer(height, weight):
standard = (height -100) * 0.9
if weight > standard:
return "偏胖"
elif weight < standard:
return "偏瘦"
else:
return "标准"
height = input('please input your height(CMs):')
weight = input('please input your weight(KGs):')
height = int(height)
weight = int(weight)
print('身高:{} cm。'.format(height))
print('体重:{} kg。'.format(weight))
answer = getAnswer(height, weight)
print('你的体重:'+ answer )
运行结果: