[Tutor] How do I go about this?

Luis N tegmine at gmail.com
Wed Jul 27 23:03:36 CEST 2005


On 7/27/05, Luis N <tegmine at gmail.com> wrote:
> 
> On 7/27/05, Nathan Pinno <falcon3166 at hotmail.com> wrote:
> 
> > Hi all,
> >  How do I go about the following: I want to write a program that will 
> > print two lists one after another, then show all the available possibilities 
> > for matches e.g a0 and x0.
> >  Here is what I have so far:
> >  lista = [x0, x1, x2, x3]
> > listb = [a0, a1, a2, a3]
> > print lista
> > print listb
> > Thanks for the help,
> > Nathan Pinno
> > 
> 
> 
> Hi,
> 
> Could you give some additional information as to what you intend to do? If 
> you are strictly matching, by position within the lists, such that you would 
> print the list elements only if: 
> 
> for x in range(min(len(lista),len(listb))):
> a = lista[x]
> b = listb[x]
> if a[1] == b[1]:
> print a, b
> 
> that is easy, however, if you want to match more complex patterns, or wish 
> to match list elements not in the same position then the complexity of the 
> task increases.
> 

Woops, I forgot the a[1], b[1]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050727/a9984e69/attachment.htm


More information about the Tutor mailing list