[Tutor] exercise correct ??
Roelof Wobben
rwobben at hotmail.com
Tue Sep 7 09:29:00 CEST 2010
Hello,
Oke, the 4 is a starting point for the index.
Next problem.
The begin looks like this :
index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4)
But in the module I get this result :
val = 5
seq = (1, 2, 4, 5, 6, 10, 5, 5
So the 4 is not avaible anymore.
Now I can change the header to index(val, seq, start=0) to index (val, seq, start)
But I think that's not what the exercise wants.
Is there another way I can use the 4 ?
Roelof
> To: tutor at python.org
> From: alan.gauld at btinternet.com
> Date: Mon, 6 Sep 2010 23:28:22 +0100
> Subject: Re: [Tutor] exercise correct ??
>
>
> "Roelof Wobben" <rwobben at hotmail.com> wrote
>
> #################
> def index_of(val, seq, start=0):
> """
> >>> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4)
> 6
> """
>
> But I get this message :
> Failed example:
> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4)
> Expected:
> 6
> Got:
> 3
> #####################
>
> > But in that tuple 5 is on position 3.
> > Is the exercise here wrong ?
>
> No because the start position is 4 so you don;t see the 5 in position
> 3.
>
> HTH,
>
> --
> Alan Gauld
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100907/ce03c7c7/attachment.html>
More information about the Tutor
mailing list