# -*- coding: utf-8 -*-height = float(input('请输入您的身高:')) weight = float(input('请输入您的体重:')) rs = height/(weight**2) if rs < 18.5: print('%f%s' % (rs, '过轻!')) elif rs <= 18.5: print('%f%s' % (rs, '正常!')) elif rs <= 25: print('%f%s' % (rs, '过重!')) elif rs <= 28: print('%f%s' % (rs, '肥胖!')) else: print('%f%s' % (rs, '严重肥胖!'))
干脆
def Pbmi(float,str): print('%f%s' % (float,str))
然后
if rs < 18.5: Pbmi(rs, '过轻!')
Sign in to make a reply
漫步云端丶衍