while True :
print('='*60)
print('*'*10,'孩子身高预测系统','*'*10)
# 功能选择
print('\ty、预测查询')
print('\tq、退出系统')
menus_select = input('请选择功能:y,q(y是进行预测查询,q是退出程序) :')
if menus_select == 'y':
father_height = float(input('请输入父亲身高:'))
mother_height = float(input('请输入母亲身高:'))
children_gender = input('请输入孩子性别M,F(M是男生,F是女生):')
sport = input("是否经常运动?y是/n否 :")
diet = input("是否饮食规律?y是/n否 :")
if children_gender == 'M':
boys_height_min = (father_height + mother_height + 1*13)/2
if sport == "y":
boys_height_min=boys_height_min*1.02
else:
boys_height_min=boys_height_min
if diet == "y":
boys_height_min=boys_height_min*1.015
else:
boys_height_min=boys_height_min
boys_height_result = f'孩子的身高预估在: {round(boys_height_min, 1)}'
print(boys_height_result)
elif children_gender == 'F':
girls_height_min = (father_height + mother_height -13)/2
if sport == "y":
girls_height_min=girls_height_min*1.02
else:
girls_height_min=girls_height_min
if diet == "y":
girls_height_min=girls_height_min*1.015
else:
girls_height_min=girls_height_min
girls_height_result = f'孩子的身高预估在: {round(girls_height_min, 1)}cm'
print(girls_height_result)
else:
print('输入有误,请重新输入')
elif menus_select == 'q':
break
else:
print('输入有误,请重新输入')
print('=' * 50)
print()
抄抄改改还在学习中大家将就看