On 7 March 2012 11:50, Mark Lawrence <breamore...@yahoo.co.uk> wrote: > On 07/03/2012 04:36, col speed wrote: >> >> On 7 March 2012 10:45, Mark Lawrence<breamore...@yahoo.co.uk> wrote: >>> >>> On 07/03/2012 03:24, col speed wrote: > >> I *think* I understand: >> Where it says: >> "For the list and tuple types, ``x in y`` is true if and only if there >>> >>> exists an index *i* such that ``x == y[i]`` is true." >> >> >> I suppose I am looking for .....an index *i* and *j* such that x[j] == >> y[i]. >> >> Is that right? > > > I reckon so although I don't believe that the interactive prompt lies. > >>>> a=tuple(range(10)) >>>> b=tuple(reversed(a)) >>>> a,b > ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9), (9, 8, 7, 6, 5, 4, 3, 2, 1, 0)) >>>> a[3] == b[3] > False >>>> a[5] == b[4] > True > >> cheers >> Col >> >>
Then we have: >>> a = tuple(range(10)) >>> b = tuple(reversed(a)) >>> any(a) in b True >>> any(b) in a True >>> any((a,b)) in (a,b) False # I think I understand this now, but I must admit it looks confusing! Thanks again Col _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor