Ad
  • Custom User Avatar

    I get the same error, however on a jupyter notebook i pass that case. Not sure why and how to print the input

    edit: nevermind, just realized my mistake

  • Default User Avatar

    Your problem is in line 9.
    list.index() returns the first index of the item. With the large pyramid, the same number is repeated in the same line more than once.

    EDIT: Also, I notice that you do copy = pyramid to try and create a copy.
    However, this is only an assignment and doesn't actually create a copy of the list.
    To make a shallow copy, you can do copy = pyramid.copy() or copy = pyramid[:].
    To make a deep copy, the easiest way is to first from copy import deepcopy then copy = deepcopy(pyramid).

  • Default User Avatar

    print the input so you can see it.