【发布时间】:2022-01-15 10:17:13
【问题描述】:
我正在制作一个简单的计算器,除其他外,它可以为用户提供他们之前计算的格式化历史记录。
print('Formmated as an equation')
for x in range(len(finalhistory)):
print(num1history(x) + float(operationHistory(x)) + num2history(x) + ' = ' +
finalhistory(x))
print(' ')
return
不过,当它运行时,我会收到一条错误消息:
Exception has occurred: TypeError
'list' object is not callable
File "MCT.py", line 34, in BH
print(num1history(x) + operationHistory(x) + num2history(x) + ' = ' + finalhistory(x))
编辑:
应该澄清调用的历史是数组。 num1history、num2history、finalhistory 存储 float 值,operationHistory 存储 str 值。
【问题讨论】:
标签: python arrays for-loop debugging