Discuss / Python / 交作业

交作业

Topic source

龅牙牧师

#1 Created at ... [Delete] [Delete and Lock User]

# -*- coding: UTF-8 -*-

#height=1.74

#weight=80.5

name=input('请输入名字:')

height=float(input('请输入身高(m):'))

weight=float(input('请输入体重(Kg):'))

BMI=weight/height**2

print('%s的BMI指数为:%.1f'%(name,BMI))

print('{0}的BMI指数为:{1:.1f}'.format(name,BMI))

print(f'{name}的BMI指数为:{BMI:.1f}')

if BMI >32:

    print('严重肥胖')

elif BMI >=28:

    print('肥胖')

elif BMI >=25:

    print('过重')

elif BMI >=18.5:

    print('正常')

else:

    print('过轻')


  • 1

Reply