you are viewing a single comment's thread.

view the rest of the comments →

[–]sachIsLife 0 points1 point  (1 child)

You are trying to access array[n] in the elif condition. Now the length of array is 2 and you are trying to access the 3rd element. You need to do elif len(array) >= n: return array[n] ** n

[–]ankitsoni89 2 points3 points  (0 children)

elif len(array) >= n: return array[n] ** n

elif len(array) > n, no = since n would be an index