热门搜索 :
考研考公
您的当前位置:首页正文

P4:判断体重(python版)

来源:东饰资讯网
# 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 )

运行结果:


output
Top