Python 体重分类程序:根据输入计算体重等级
weight = input('请输入体重(单位:斤):') if not weight.isdigit(): # 判断输入是否为数字 print('输入不合法!') else: weight = int(weight) if weight > 0 and weight <= 80: print('变成', weight + 80, '斤,属于瘦瘦的') elif weight >= 81 and weight <= 120: print('变成', weight + 40, '斤,属于中等') elif weight >= 121: print('变成', weight + 40, '斤,属于肥胖') else: print('输入不合法!')
原文地址: https://www.cveoy.top/t/topic/oFdu 著作权归作者所有。请勿转载和采集!