Hi Andrea, You can use lambda or list comprehension to solve your problem in one step.
I am more comfortable with lambda so will explain that way. Please follow below lines of code. andreea_list = [['1', ' james', ' 1', ' 90'], ['2', ' alice', ' 1', ' 95'], ['5', ' jorgen', ' 1', '99']] andrea_float_list = map(lambda x:float(x[0]),andreea_list) print andrea_float_list map is function which takes two arguments first is an anonymous function called lamda which operates on each of the list element one at a time and the other is list it self. you can read about lambdas here http://www.python-course.eu/lambda.php Thanks , Anshu On Fri, Oct 9, 2015 at 1:10 AM, Andrea Nguy <andrea.n...@gmail.com> wrote: > Hi there, > > I’m trying to learn some Python programming on my own. What’s happening is > that I am trying to take a list of a list as such: [['1', ' james', ' 1', ' > 90'], ['2', ' alice', ' 1', ' 95'], ['5', ' jorgen', ' 1', ' 99’]] (it > continues) from a text file. > > However, what I am trying to do take the indexes of thelist[0][1] and > theist[0][3] and times them by a float number - returning the list with all > of the values multiplied according to the float. > > Is this possible? I am trying to iterate that throughout the entire list > or would it be easier if I tried to change the list of the list into a > dictionary for efficiency? > > Thanks! > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor