I am a begineer python programmer... just completed a introduction course.

I am doing some programming on my own... when I came ran into this problem.

I keep on getting this error "IndexError: too many indices." This is becouse the "x" is a indexing array and the t is a list. How do i convert this list to an indexing array?

thank you for your help in advance.

from pylab import * from numpy import * y=[1,2,3,4,5,6,7,8,9,10] x = ones((1,4))*linspace(0,4,4) t=y[0:4] #pick out four numbers x = transpose(x) t = transpose(t) print " len t= : ",len(t) print " len x= : ",len(x) print "t = : ",t print "x = : ",x # Split into training, testing, and validation sets train = x[0::2,:] test = x[1::4,:] valid = x[3::4,:] traintarget = t[0::2,:] #I get an error here testtarget = t[1::4,:] validtarget = t[3::4,:] # Plot the data plot(x,t,'o') xlabel('x') ylabel('t') show()