[Tutor] Bounded Linear Search
toganm at users.sourceforge.net
toganm at users.sourceforge.net
Sun Oct 16 19:04:41 CEST 2011
Peter Otten wrote:
> To verify that the algorithm is correct now you could walk through
> increasingly more complex sample data, which may be possible in this case,
> but rarely ever for an entire script. Instead the common approach is to
> pick a few samples along with the expected outcomes, feed them to your
> function and verify that they give the expected output
>
> def unique_values(items):
> ...
> return uniq
>
> assert unique_values([42, 42]) == [42]
> assert unique_values([1, 2, 3, 2]) == [1, 2, 3]
Thanks for the tip and where I was failing to see
Togan
More information about the Tutor
mailing list