weight = input('请输入体重(单位:斤):') # 提示用户输入体重 weight = int(weight) # 将输入的字符串类型转换成整型

if weight < 0 or weight > 80: # 判断体重是否合法 print('非法输入') elif weight <= 80: print('偏瘦') elif weight <= 120: print('中等') else: print('肥胖')

Python 体重分类程序 - 判断偏瘦、中等、肥胖

原文地址: https://www.cveoy.top/t/topic/oFfm 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录