导航:首页 > 编程语言 > python编程体重单位转换

python编程体重单位转换

发布时间:2022-07-14 02:35:48

python计算BMI值

废话不多说,改进版继续上程序哈:
def bmi():
name=input('Name:')
height=input('Height(m):')
weight=input('Weight(kg):')
BIM=float(float(weight)/(float(height)**2))
print('您的BIM指数为:',BIM)
if BIM <18.5:
print('你太轻了!')
elif BIM<=25:
print('标准体重哦哦!')
elif BIM<=32:
print('您有点微胖哦哦!')
else:
print('您太胖了,该减肥了')
bmi()
for i in range(10):
choose =input('您是否愿意继续计算BMI(y/n):')
if choose=='y':
bmi()
else:
break

❷ python语言计算BMI值,感谢求解!

sg=input('你的身高多少(米):')
tz=input('你的体重多少(公斤):')

BMI=round(float(tz)/float(sg)**2,1)

ifBMI<18.5:
print('BMI={0},{1}'.format(BMI,'偏瘦'))
elif18.5<=BMI<24.9:
print('BMI={0},{1}'.format(BMI,'标准'))
elif25.0<=BMI<29.9:
print('BMI={0},{1}'.format(BMI,'超重'))
elif25<=BMI:
print('BMI={0},{1}'.format(BMI,'肥胖'))

这是委托我读五年级的儿子写的。^_^

❸ 怎么用python算bmi 简单编程 在线等

weight=int(raw_input("请输入体重(千克):"))
height=int(raw_input("请输入身高(米):"))
BMI=weight/(height*height)
print "BMI=",BMI

if BMI<19:
print“轻体重"
elif BMI>=19 and BMI<25:
print"健康身体"
elif BMI>=25 and BMI<28:
print"超重“
else:
print"肥胖”
raw_input("press any key to quit.")

❹ python bmi公式怎么用

weight=int(raw_input("请输入体重(千克):"))
height=int(raw_input("请输入身高(米):"))
BMI=weight/(height*height)
print "BMI=",BMI

if BMI<19:
print“轻体重"
elif BMI>=19 and BMI<25:
print"健康身体"
elif BMI>=25 and BMI<28:
print"超重“
else:
print"肥胖”
raw_input("press any key to quit.")

❺ 用Python小张的年龄是26 体重是72.5千克,身高是1.82m则输出26,72.5,1.82

这是Python语言中字典的应用,先创建一个字典,将小张的年龄,体重,身高以键值对的方式写入字典,再打印key值就得到相应的数据了!

❻ python的单位转换问题

round()函数用错了啊,你应该写成:
lb = round(fx*2.205, 2)
这样。

round(x[, n])
Return the floating point value x rounded to n digits after the decimal point. If n is omitted, it defaults to zero. Delegates to x.__round__(n).

For the built-in types supporting round(), values are rounded to the closest multiple of 10 to the power minus n; if two multiples are equally close, rounding is done toward the even choice (so, for example, both round(0.5) and round(-0.5) are 0, and round(1.5) is 2). The return value is an integer if called with one argument, otherwise of the same type as x.

❼ 求助:用Python实现国际单位换算

知道进制就可以换算啦,每一个换算用一种方法实现。如:
def kg2g(kg):
return 1000 * kg

def g2kg(g):
return g / 1000

❽ python重量计算编程

x1=50
y1 = x1 + 0.5*10
y2 = y1 * 0.165

❾ Python让用户输入自己的体重,以克为单位转化为千克,但是现在我不知道怎么让用户输入的代码

defconvert_kg(g):
returnstr(g/1000.0)+'kg'
print(convert_kg(int(input('请输入体重(克):'))))

python3版本。python2的话中文要用unicode。想学好python可以关注我的课程,谢谢

阅读全文

与python编程体重单位转换相关的资料

热点内容
高尔夫电台怎么添加到文件夹 浏览:237
四川麻将一般下哪个app 浏览:862
反编译exe脚本 浏览:460
源码文件夹怎么编译到固件中 浏览:910
ERp打印服务器错误怎么弄 浏览:111
蚌端口u盘加密软件有哪些 浏览:178
前端如何认证服务器 浏览:554
linux切换db2用户命令 浏览:308
相片如何用电解压 浏览:906
硕士程序员去学校当老师 浏览:120
pythonstr提取到字典 浏览:818
程序员那么可爱有人看上陆漓了 浏览:878
php正则提取图片 浏览:105
pythonlinuxdjango 浏览:562
php中文返回乱码 浏览:91
宿舍装的电信怎么加密 浏览:745
为什么压缩文件解压后变少了 浏览:426
现在安卓充电器普遍是什么型号 浏览:717
9日均线36均线主图指标源码 浏览:351
程序员阿里文化完整版 浏览:100