Re: comparing tuples

2010-08-22 Thread Baba
On Aug 22, 7:12 pm, Tim Chase wrote: > On 08/22/10 12:50, Baba wrote: > > > > > level: beginners > > > I was trying to write simple code that compares 2 tuples and returns > > any element in the second tuple that is not in the first tuple. > > > def tuples(t1, t2): > >      result = [] > >      fo

Re: comparing tuples

2010-08-22 Thread Tim Chase
On 08/22/10 12:50, Baba wrote: level: beginners I was trying to write simple code that compares 2 tuples and returns any element in the second tuple that is not in the first tuple. def tuples(t1, t2): result = [] for b in t2: for a in t1: if b == a:

comparing tuples

2010-08-22 Thread Baba
level: beginners I was trying to write simple code that compares 2 tuples and returns any element in the second tuple that is not in the first tuple. def tuples(t1, t2): result = [] for b in t2: for a in t1: if b == a: break else: re