fork download
  1. height = 1.75
  2. weight = 75
  3. username = '小明'
  4. bmi = weight / height**2
  5. print(f'{username}您好,您的体质指数为{round(bmi,1)}')
  6. if bmi <= 18.5 :
  7. print(f' {username} 您好,您的体质 偏瘦 ')
  8. elif bmi <= 24.9 :
  9. print(f' {username} 您好,您的体质 正常 ')
  10. elif bmi <= 29.9 :
  11. print(f' {username} 您好,您的体质 超重 ')
  12. else:
  13. print(f' {username} 您好,您的体质 肥胖 ')
Success #stdin #stdout 0.07s 7992KB
stdin
Standard input is empty
stdout
小明您好,您的体质指数为24.5
   小明        您好,您的体质 正常