> From: keithw...@gmail.com
> Date: Mon, 13 Jan 2014 12:56:45 -0500
> Subject: Re: [Tutor] another better way to do this ?
> To: rwob...@hotmail.com
> CC: tutor@python.org
> 
> On Mon, Jan 13, 2014 at 1:14 AM, Roelof Wobben <rwob...@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
                                          
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to