Re: [Tutor] why does this fail

2010-08-26 Thread Alan Gauld
"Roelof Wobben" wrote then I have a problem. Im following this book : http://openbookproject.net/thinkcs/python/english2e/ which is the first link in the beginners tutorial page. And it's talking about the string modules. So it is which is quite bizarre since it is using Python 2.5! The

Re: [Tutor] why does this fail

2010-08-25 Thread Roelof Wobben
an.ga...@btinternet.com Subject: Re: [Tutor] why does this fail To: rwob...@hotmail.com Thats OK, I only replied because what you said could genuinely have been a mistake because some old tutorials still refer to the string module amnd its functions. Because other begineers may read the post t

Re: [Tutor] why does this fail

2010-08-25 Thread Steven D'Aprano
On Thu, 26 Aug 2010 04:18:28 am Greg Bair wrote: > I'm assuming what you really want is : > > if letter in strng: >     print "true" > else: >     print "false" Oh I hope not... the above is better written as: print letter in strng (assuming you don't care about the difference between "True" an

Re: [Tutor] why does this fail

2010-08-25 Thread Alan Gauld
"Roelof Wobben" wrote It's for learning purposed but I forget that de module string has built in functions.Thank you for remainding it to me. Its not the string module that Christian is referring to, its the methods of string objects - different things: You can do: import string string.

Re: [Tutor] why does this fail

2010-08-25 Thread Alan Gauld
"Roelof Wobben" wrote ## def remove_letter(letter, strng): antwoord="" for letter in strng: print letter, strng if letter in strng: print "false" else: print "true" return antwoord ## Several issues: 1

Re: [Tutor] why does this fail

2010-08-25 Thread Greg Bair
On 08/25/2010 06:00 AM, Roelof Wobben wrote: > > Hello, > > > > I have this programm : > > > > def remove_letter(letter, strng): > """ > >>> remove_letter('a', 'apple') > 'pple' > >>> remove_letter('a', 'banana') > 'bnn' > >>> remove_letter('z', 'banana')

Re: [Tutor] why does this fail

2010-08-25 Thread Roelof Wobben
> Date: Wed, 25 Aug 2010 12:27:39 +0200 > From: cwi...@compuscan.co.za > To: tutor@python.org > Subject: Re: [Tutor] why does this fail > > On 25/08/2010 12:00, Roelof Wobben wrote: > > Hello, > > > > I have this programm : >

Re: [Tutor] why does this fail

2010-08-25 Thread Christian Witts
On 25/08/2010 12:00, Roelof Wobben wrote: Hello, I have this programm : def remove_letter(letter, strng): """ >>> remove_letter('a', 'apple') 'pple' >>> remove_letter('a', 'banana') 'bnn' >>> remove_letter('z', 'banana') 'banana' >>> remove_letter('i', 'Mississippi')

[Tutor] why does this fail

2010-08-25 Thread Roelof Wobben
Hello, I have this programm : def remove_letter(letter, strng): """ >>> remove_letter('a', 'apple') 'pple' >>> remove_letter('a', 'banana') 'bnn' >>> remove_letter('z', 'banana') 'banana' >>> remove_letter('i', 'Mississippi') 'Mpp'