2016-10-26 73 views
0
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:不能由非INT繁衍序列類型 'STR'系統內置命令錯誤

回答

0

嘗試......

weight = float(input("What Is Your Weight:")); 
height = float(input("What Is Your Height, Answer In Metres:"));