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.
>
Yes it is. It is the start parameter.
The function definition is
def index_of(val, seq, start=0):
val is the first value, 5, seq is the tuple and start is 4.
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.
>
Why would you want to do that? It would force you to provide a start value
for every call. The point of having a default value (=0) is so that you do not
need to specify start every time you use the function. But eveb if you do not
use the start value it will still have a value, 0.
There is no difference, you can access it exactly like the other parameters.
Just use its name.
HTH,
Alan G.
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor