【发布时间】:2014-03-17 16:57:54
【问题描述】:
当我运行我的代码时,程序总是返回:
'str' object is not callable在第九行,我不知道为什么。
sum = 0
count = 0
binNum = input('Input your number: \n')
while count != len(binNum):
if binNum(count) == 1:
sum = sum + 2**count
count = count + 1
else:
count = count + 1
if count == len(binNum):
print(sum)
感谢您的帮助。
【问题讨论】:
-
你希望
binNum(count)做什么? -
如果你在 Python 2 上,那么你使用
raw_input()代替
标签: python string syntax converter