Hello,
I have this programm : def index_of(val, seq, start=0): """ >>> index_of(9, [1, 7, 11, 9, 10]) 3 >>> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5)) 3 >>> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4) 6 >>> index_of('y', 'happy birthday') 4 >>> index_of('banana', ['apple', 'banana', 'cherry', 'date']) 1 >>> index_of(5, [2, 3, 4]) -1 >>> index_of('b', ['apple', 'banana', 'cherry', 'date']) -1 """ plek = 0 if type(seq) == type([]): plek = seq.index(val) elif type(seq) == type(()): seq = list (seq) plek = seq.index(val) else : plek = seq.find(val) return plek But I get this message : File "C:\Users\wobben\workspace\oefeningen\src\test.py", line 70, in __main__.index_of 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 ? Roelof
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor