I=eval(input())
B=eval(input())
C=I/(B**2)
if C<18.5:
print("BMI数值为:{}".format(C)+"\n"+"指标为:国际'偏瘦',国内'偏瘦'")
else:
print("BMI数值为:{}".format(C)+"\n"+"指标为:国际'偏胖',国内'偏胖'")
代码 没有问题,检查一下看看缩进和括号有没有写对,要写成全英文标点符号。
I=eval(input())
B=eval(input())
C=I/(B**2)
if C<18.5:
print("BMI数值为:{}".format(C)+"\n"+"指标为:国际'偏瘦',国内'偏瘦'")
else:
print("BMI数值为:{}".format(C)+"\n"+"指标为:国际'偏胖',国内'偏胖'")
运行测试:
F:\2022\pythontest>t8
50
19.2
BMI数值为:0.13563368055555555
指标为:国际'偏瘦',国内'偏瘦'
当运行代码报错SyntaxError: unexpected EOF while parsing时。就是eval()转化了空行,或者空字符。或者{,[,- 等等符号
您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!