typeerror 'builtin_function_or_method' object has no attribute '__getitem__'

前端 未结 2 1269
野趣味
野趣味 2021-01-04 00:32

Here\'s the code:

The_Start = [1,1]
The_End = [1, 1]
for z in range(20):
    for x in range(len(The_Start) - 1):
        y  = The_Start[x] + The_Start[x + 1]         


        
2条回答
  •  我在风中等你
    2021-01-04 00:47

    You need to change the brackets in The_End.insert[x + 1, y] to parenthesis.

    The_End.insert(x + 1, y)
    

    It's good practice in Python to use lowercase variable names. Uppercase is generaly used for classes.

提交回复
热议问题