On 25/06/12 23:12, Mike Nickey wrote:

I did the same exercise so maybe I can assist here. From what I see, the line...
if w.startswith('x'): seems to be ineffective.

If that's true you have a seriously broken version of Python!
startswith() is a better idiom because it conveys the intent much more clearly. And it should work just fine!

>>> 'xray'.startswith('x')
True
>>> 'xray'.startswith('y')
False
>>>

The only real downside is a few extra characters typing!

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to