[Tutor] How do I go about this?
Nathan Pinno
falcon3166 at hotmail.com
Wed Jul 27 23:07:48 CEST 2005
Luis and all,
I want to more than matching, I am trying to find all the available combos, e.g a1 == x1 or a1 == x2 or a1 != x1.
HTH,
Nathan Pinno
I also noticed you forgot the a[1] == b[1]. (grin) :)
----- Original Message -----
From: Luis N
To: tutor at python.org
Sent: Wednesday, July 27, 2005 3:01 PM
Subject: Re: [Tutor] How do I go about this?
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 == b:
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.
------------------------------------------------------------------------------
_______________________________________________
Tutor maillist - Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050727/3af97a8f/attachment.htm
More information about the Tutor
mailing list