[Tutor] A very simple question
Raymond Hettinger
python@rcn.com
Thu, 30 May 2002 10:51:20 -0400
def checkIfOnlyLower(list):
for item in list:
if not item[0].islower():
return 0
return 1
Raymond Hettinger
----- Original Message -----
From: "Nicole Seitz" <Nicole.Seitz@urz.uni-hd.de>
To: <tutor@python.org>
Sent: Thursday, May 30, 2002 12:34 PM
Subject: [Tutor] A very simple question
Hi there!
I'd like to write a function that gets a list , checks if there are only
strings in the list starting with a lowercase letter and then returns 1 if
only lowercase, 0 if not.
How can I do that?
example list:
myList = [ "abc", "def", "Cde"]
If I write:
def checkIfOnlyLower(list):
for item in list:
if item[0].islower():
return 1
else:
return 0
the function will return 1 as soon as it comes to the first string starting
with a lowercase letter.But that's not what I want.
Hope you can help me.
Thanks in advance.
Nicole
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor