<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
Hello, <BR>
<BR>
I have this programm :<BR>
<BR>
def index_of(val, seq, start=0):<BR> """<BR> >>> index_of(9, [1, 7, 11, 9, 10])<BR> 3<BR> >>> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5))<BR> 3<BR> >>> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4)<BR> 6<BR> >>> index_of('y', 'happy birthday')<BR> 4<BR> >>> index_of('banana', ['apple', 'banana', 'cherry', 'date'])<BR> 1<BR> >>> index_of(5, [2, 3, 4])<BR> -1<BR> >>> index_of('b', ['apple', 'banana', 'cherry', 'date'])<BR> -1<BR> """<BR> plek = 0 <BR> if type(seq) == type([]):<BR> plek = seq.index(val)<BR> elif type(seq) == type(()):<BR> seq = list (seq)<BR> plek = seq.index(val)<BR> else :<BR> plek = seq.find(val)<BR> return plek <BR> <BR>
<BR>
But I get this message :<BR>
<BR><FONT size=2>
<P align=left>Fi</FONT><U><FONT color=#000080 size=2><FONT color=#000080 size=2>le "C:\Users\wobben\workspace\oefeningen\src\test.py", line 70, in __main__.index_of</P></U></FONT></FONT><FONT size=2>
<P align=left>Failed example:</P>
<P align=left>index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4)</P>
<P align=left>Expected:</P>
<P align=left>6</P>
<P align=left>Got:</P>
3<BR>
<BR>
But in that tuple 5 is on position 3.<BR>
<BR>
Is the exercise here wrong ?<BR>
<BR>
Roelof<BR>
<BR></FONT>                                            </body>
</html>