fork download
  1. # 定义身高变量
  2. height = 1.75
  3. # 定义体重变量
  4. weight = 75
  5. # 定义用户名变量
  6. username = '小明'
  7. # 求体质指数
  8. bmi = weight / height**2
  9. # 打印体质指数
  10. print(f'{username}您好,您的体质指数为{round(bmi, 1)}')
Success #stdin #stdout 0.02s 9312KB
stdin
Standard input is empty
stdout
小明您好,您的体质指数为24.5