Python学习----eval函数,if-else分支语句

由于input函数输入结果返回的是字符串,如果要进行数值运算则

a=eval(input("input something:"))
\\此时a返回的是数字

通往天堂的选择

print('when you come to the door,you choose a angel to ask.')
question=input('the other door is to tian tang?')
answer=input("the angel's word:")

if answer==yes

 BMI

'''
BMI
'''
h=eval(input('please input your height(meter):'))
w=eval(input('please input your weight(kg):'))
BMI=w/pow(h,2)
print("{:.2f}".format(BMI))
if BMI<=18.5:
    print('pian shou')
elif 18.5<BMI<24:
    print('zheng chang')
elif 25<BMI<30:
    print('pian pang')
else:
    print('fei pang')
       

猜你喜欢

转载自blog.csdn.net/printfsome/article/details/81084138
今日推荐