【发布时间】:2017-06-22 00:46:38
【问题描述】:
我刚刚开始使用 python,并且我以前的编码经验很少。
我创建了一个简单的程序来计算百分比变化,但是要打印的行我正在尝试稍微复杂一些的东西。
我当前的代码如下:
num1 = float(input("what is the original number?"))
modi = float(input("How much do you want to increase it by?(please use 0.83/1.56 types rather than percentages)"))
ans = num1 * modi
print(ans,"is",modi,"times"if modi > 1 ("greater than")else "less than",num1)
计算工作正常,但每当我集成更高级版本的打印线时,就会出现错误:
TypeError: 'int' 对象不可调用
我看不出有什么问题,你可以吗?
【问题讨论】: