I keep getting "IndexError: list assignment index out of range." I'm still trying to get the hang of Python. Why do I get an index error when running the program. Is there a better way to go about this? This is just a chunk out of my code.
T=a=h=FA=[]
i=1
T[i]=10*(.0001)
a[i]=-1
h[i]=(4)/2
FA[i]=function(-1)
I just want to have the sets equal the values at i=1.
Your list is empty, hence there is no element 1 to replace. Also, they're all bound to the same list. You don't want that.
T=[]
a=[]
h=[]
FA=[]
T.append(10*(.0001))
a.append(-1)
h.append((4)/2)
FA.append(function(-1))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With