Re: Help with this code

2017-01-10 Thread jladasky
On Monday, January 9, 2017 at 12:50:11 PM UTC-8, Joaquin Alzola wrote: > >> elements. For example, if we have a list_a=["a","b","c","d"] and > >> list_b=["a","b"] I want to obtain a new list_c containing elements that > >> match between these lists (a and b here), > > >Perhaps this might work: >

RE: Help with this code

2017-01-09 Thread Joaquin Alzola
>> elements. For example, if we have a list_a=["a","b","c","d"] and >> list_b=["a","b"] I want to obtain a new list_c containing elements that >> match between these lists (a and b here), >Perhaps this might work: list(set(list_a).intersection(set(list_b))) >['a', 'b'] >>> list_a={"a","b","

Re: Help with this code

2017-01-09 Thread Joel Goldstick
On Mon, Jan 9, 2017 at 1:02 PM, Gilmeh Serda wrote: > On Mon, 09 Jan 2017 05:08:51 -0800, José Manuel Suárez Sierra wrote: > >> elements. For example, if we have a list_a=["a","b","c","d"] and >> list_b=["a","b"] I want to obtain a new list_c containing elements that >> match between these lists (

Re: Help with this code

2017-01-09 Thread Peter Otten
José Manuel Suárez Sierra wrote: > This is the traceback: > line 18, in > for transf2[j] in transf2: > IndexError: list assignment index out of range > > If I have initialized j=0 (such as i) why does it not work? A for loop for x in y: ... sequentually assigns every value in y to x. So wi

Re: Help with this code

2017-01-09 Thread José Manuel Suárez Sierra
El lunes, 9 de enero de 2017, 14:09:09 (UTC+1), José Manuel Suárez Sierra escribió: > Hello, I am trying to make a code wich compares between 2 or several > sequences (lists). It compares every element in a list with another list > elements. For example, if we have a list_a=["a","b","c","d"] an

Re: Help with this code

2017-01-09 Thread José Manuel Suárez Sierra
El lunes, 9 de enero de 2017, 14:09:09 (UTC+1), José Manuel Suárez Sierra escribió: > Hello, I am trying to make a code wich compares between 2 or several > sequences (lists). It compares every element in a list with another list > elements. For example, if we have a list_a=["a","b","c","d"] an

Re: Help with this code

2017-01-09 Thread Peter Otten
José Manuel Suárez Sierra wrote: > Hello, Welcome! > I am trying to make a code wich compares between 2 or several > sequences (lists). It compares every element in a list with another list > elements. For example, if we have a list_a=["a","b","c","d"] and > list_b=["a","b"] I want to obtain a

RE: Help with this code

2017-01-09 Thread Deborah Swanson
José Manuel Suárez Sierra wrote, on January 09, 2017 5:09 AM > > Hello, I am trying to make a code wich compares between 2 or > several sequences (lists). It compares every element in a > list with another list elements. For example, if we have a > list_a=["a","b","c","d"] and list_b=["a","b"]