[Tutor] exercise correct ??

Alan Gauld alan.gauld at btinternet.com
Tue Sep 7 00:28:22 CEST 2010


"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/




More information about the Tutor mailing list