[Trouble Shooting - Python] TypeError: 'builtin_function_or_method' object is not subscriptable

1. Background: python 3/win10

2. Error Line:

idx = nums.index[target-operand1]

3. Solution

index()是对list的函数,所以要用圆括号,而不是方括号

idx = nums.index(target-operand1)

 

posted @ 2018-04-30 06:48  break大蜗牛  阅读(4026)  评论(0编辑  收藏  举报