[Tutor] Updating index of a list

Emile van Sebille emile at fenx.com
Thu Oct 8 23:29:33 CEST 2015


On 10/8/2015 12:40 PM, Andrea Nguy 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]

which has a value of 'james'  (being index 1 of list 0)

> and theist[0][3]

which has a value of ' 90'

that should get you going.

Emile


> 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 at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>




More information about the Tutor mailing list