[Tutor] another better way to do this ?
Roelof Wobben
rwobben at hotmail.com
Mon Jan 13 19:06:32 CET 2014
> From: keithwins at gmail.com
> Date: Mon, 13 Jan 2014 12:56:45 -0500
> Subject: Re: [Tutor] another better way to do this ?
> To: rwobben at hotmail.com
> CC: tutor at python.org
>
> On Mon, Jan 13, 2014 at 1:14 AM, Roelof Wobben <rwobben at hotmail.com> wrote:
> > I have read all comments and im a little bit confused.
> > About which script are we talkimng about. I have seen a lot.
>
>
> I am talking about the script/approach I posted. Others have posted
> other scripts. Hopefully you have the capacity, with whatever approach
> to reading email you have, to go back and look over messages?
>
> There is some confusion because your original message specified that
> order was important, though the examples you gave did not indicate
> that (in fact, contradicted it). Also, there was never anything
> specified about repeated letters: what would be the result of
> fix_machine("letr", "letter") (not to be confused with
> fix_machine("letter", "letr"), which would definitely be "letr").
>
> --
> Keith
Oke,
I think you mean this script :
def fix_machine(debris, product):
index = 0
for letter in product:
test = debris.find(letter, index)
if test!= -1:
index = test
else: # Failure
return "Give me something that's not useless next time."
return product # Success
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140113/00e40710/attachment.html>
More information about the Tutor
mailing list