On Wednesday 13 February 2008 18:49, Arun Srinivasan wrote:
> I'm trying to learn Python, and I decided to try kata 2 </> from the
> CodeKate website. It's basically just a challenge to implement a binary
> search in different ways.
>
> I wrote an implementation that works, but I'm confused as to why.
>
> def chop(search_int, sorted_list):

>     if len(sorted_list) == 1 or 2:

This condition is always true.  You meant to say:  len(sorted_list) == 1 or 
len(sorted_list) == 2"

or: "len(sorted_list) in 1,2"

Cheers
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to