From dc4282f76612c5c9fe0d77db4f126fe8bb7a31fb Mon Sep 17 00:00:00 2001 From: Jenny Date: Mon, 28 Aug 2017 14:46:40 -0400 Subject: [PATCH] Update bin_search.py Fix the division to yield integer for index --- Chapter09/bin_search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Chapter09/bin_search.py b/Chapter09/bin_search.py index 223e916..7e4f388 100644 --- a/Chapter09/bin_search.py +++ b/Chapter09/bin_search.py @@ -8,7 +8,7 @@ def binary_search(ordered_list, term): index_of_last_element = size_of_list while index_of_first_element <= index_of_last_element: - mid_point = (index_of_first_element + index_of_last_element)/2 + mid_point = (index_of_first_element + index_of_last_element) // 2 if ordered_list[mid_point] == term: return mid_point