【发布时间】:2017-08-23 16:29:53
【问题描述】:
我正在使用 Python 2,但出现错误:
TypeError:不支持的操作数类型/:'str'和'float'当脚本运行到最后一行时。我不明白哪个变量仍然是字符串类型。
from sys import argv
script, age, height=argv
print 'you\'re %r old'%age
weight=input('and i need your weight to calculate BMI, can you tell me:')
print 'your BMI is %r'%weight/((float(height)/100)**2)
【问题讨论】:
-
为什么不打印出所有的变量类型和它们的值?这会立即显示出来。
标签: python python-2.7