I'm experimenting with a few python programming elements and trying to produce an array of Catalan Numbers in the process.
I keep getting the aforementioned error, but I can't seem to reason out why or find any enlightening sources of info.
The function calculates the next element of list C using the current element, starting with C[0]=0.
I've reduced my code to make things simpler yet still preserve the error.
from math import *
C = []
C += [0]
def ppC(n,C): # increment list C
print( C[n] ) # list index out of range
C += [ C[n]*(4*n+2)/(n+2) ]
n += 1
ppC(n+1,C) # recursive
ppC(0,C) # RUN