diff --git a/binary-search/download_imdb.py b/binary-search/download_imdb.py index 45a97f4171..e572681b7a 100644 --- a/binary-search/download_imdb.py +++ b/binary-search/download_imdb.py @@ -22,11 +22,9 @@ def main(): with open("names.txt", "w", encoding="utf-8") as destination: destination.writelines(names()) - with ( - open("names.txt", encoding="utf-8") as source, - open("sorted_names.txt", "w", encoding="utf-8") as destination, - ): - destination.writelines(sorted(source.readlines())) + with open("names.txt", encoding="utf-8") as source: + with open("sorted_names.txt", "w", encoding="utf-8") as destination: + destination.writelines(sorted(source.readlines())) print('Created "names.txt" and "sorted_names.txt"') diff --git a/binary-search/search/binary.py b/binary-search/search/binary.py index 0dd6a2d80c..3c32dad0ee 100644 --- a/binary-search/search/binary.py +++ b/binary-search/search/binary.py @@ -68,7 +68,7 @@ def find_all_indices( left = find_leftmost_index(elements, value, key) right = find_rightmost_index(elements, value, key) - if left and right: + if left is not None and right is not None: return set(range(left, right + 1)) return set()