[Tutor] membership

Kalle Svensson kalle@gnupung.net
Tue, 4 Dec 2001 23:20:59 +0100


[john public]
> does the membership (in) function work for lists and
> strings like it does for Tuples?

Yes, it does:
"1" in ["1", "2"]
is true, as is
"1" in "12"
and
"1" in ("1", "2")

>  is the there a got line X function in Python for
> creating loops?

I'm not sure what you're asking about here.  The canonical loop in Python is
the for loop over a sequence:

for x in [1, "foo", 3]:
    print x

will print

1
foo
3

A while loop is also available:

x = 0
while x < 3:
    print x
    x = x + 1

will print

0
1
2

>  How do I unsubscribe from the daily digest? TIA

Go to the URI
http://mail.python.org/mailman/listinfo/tutor
and enter your email address in the form at the bottom of the page and submit.
>From the following page you can edit your membership information and
unsubscribe.

Peace,
  Kalle
-- 
[  Laziness, impatience, hubris:  Pick two!  ]
[   International: http://www.gnupung.net/   ]
[ Svenska: http://www.lysator.liu.se/~kalle/ ]