猫史档案馆


【Python作品分享】体重测量仪【作品秀】

用户:保守的皮皮蟹9MZD保守的皮皮蟹9MZD查看:0 回复:0 评论:0 创建时间:2020-06-27T10:01:33


【作品展示】

center_image

 

【作品介绍】

覅I

 

【作品源代码】

gender = input("输入性别(男\女.[M]ale\[F]emale:")
height = input("输入身高:")
weight = input("输入体重:")

height = int(height)
weight = int(weight)

if gender == 'M' or gender == '男':
    std_weight = height - 100
    d = weight - std_weight
    if d > -3:
        print("您的体重超重,应当增加体育运动",d,"公斤")
    elif d < -3:
        print("您的体重偏瘦,应当加重食量",d,"公斤")
    else:
        print("标准体重",d,"公斤")
elif gender in ['F',"女"]:
    std_weight = height - 110
    d = weight - std_weight
    if d > 3:
        print("您的体重超重,应当增加体育运动", d, "公斤")
    elif d < -3:
        print("您的体重偏瘦,应当加重食量", d, "公斤")
    else:
        print("标准体重", d, "公斤")

else:
    print("输入错误")

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页