このコードの何が問題なのかわかりません。Python 2.7 を使い始めたばかりで、この bmi 計算スクリプトで問題が発生しました。
def bmi_calculator():
print "Enter your appelation (Mr., Mrs., Dr., ...): "
appelation = raw_input()
print "Enter your first name: "
fname = raw_input()
print "Enter your last name: "
lname = raw_input()
print "Enter your height in inches: "
height = raw_input()
print "Enter your weight in pounds: "
weight = raw_input()
feet = (height/12)
inches = (height-feet)*12
bmi = ((weight/(height*height))*703)
print "BMI Record for %s %s %s:" % (appelation,fname,lname)
print "Subject is %d feet %d inches tall and weighs %d pounds" % (feet,inches,weight)
print "Subject's BMI is %d" % (bmi)
誰かが私が間違っていることを教えてくれませんか?
これがエラーです
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "a1.py", line 88, in bmi_calculator
feet = (height/12)
TypeError: unsupported operand type(s) for /: 'str' and 'int'