"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
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
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
"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.
"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
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')
> 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 :
>
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')
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'