Re: [Tutor] question about a list of lists

2007-01-29 Thread Kent Johnson
shawn bright wrote: > Thanks Kent, >i am going with option A, the helper set, because i also need to > count the occurances and this seems to be the easiest solution. If you need the number of unique items that is just the length of the final list. If you need the number of occurrences of ea

Re: [Tutor] question about a list of lists

2007-01-29 Thread shawn bright
Thanks Kent, i am going with option A, the helper set, because i also need to count the occurances and this seems to be the easiest solution. thanks for your help. shawn On 1/28/07, Kent Johnson <[EMAIL PROTECTED]> wrote: shawn bright wrote: > lo there all. > > i have a list of lists that i

Re: [Tutor] question about a list of lists

2007-01-28 Thread Kent Johnson
shawn bright wrote: > lo there all. > > i have a list of lists that i want to build, only if an item is not in > the list already. > > kinda like this > new_list = [] > for item in lists: # item will look something like [var1, var2, var3] > if item[0] in new_list ( only the first element of

Re: [Tutor] question about a list of lists

2007-01-28 Thread Alan Gauld
"shawn bright" <[EMAIL PROTECTED]> wrote > new_list = [] > for item in lists: # item will look something like [var1, var2, > var3] >if item[0] in new_list > basicly, i want to know if item[0] is one of the items[0] in my > new_list Your pseudo code is pretty much exactly right. What mor