name = raw_input("Hi Your Name Please:");
weight = input("What Is Your Weight:");
height = input("What Is Your Height, Answer In Metres:");
bmi = (weight/(height*height));
if bmi >= 30:
print("Hi %s, you\'re obese."\
" Your bmi is %d" % (name,bmi));
elif bmi >=25 and bmi < 30:
print("Hi %s, you\'re overweight."\
" Your bmi is %d" % (name, bmi));
elif bmi >= 18 and bmi < 25:
print("Hi %s, you\'re ideal."\
" Your bmi is %d" % (name, bmi));
elif bmi < 18:
print("Hi %s, you\'re underweight."\
" Your bmi is %d" % (name,bmi));
为什么这段代码不适用于wingide-101-5.1.1 wingide-101-5.1.1上出现错误:builtins.TypeError:不能将序列乘以'str'类型的非int
答案 0 :(得分:0)
试试这个......
weight = float(input("What Is Your Weight:"));
height = float(input("What Is Your Height, Answer In Metres:"));