diff --git a/sorts/heap_sort.py b/sorts/heap_sort.py index 6d731cd4b..7882c200f 100644 --- a/sorts/heap_sort.py +++ b/sorts/heap_sort.py @@ -42,8 +42,8 @@ def heap_sort(unsorted): >>> heap_sort([-2, -5, -45]) [-45, -5, -2] """ - n=len(unsorted) - for i in range (n/2 - 1 , -1, -1) : + n=len(unsorted) + for i in range (n/2 - 1 , -1, -1): heapify(unsorted,i,n) for i in range(n - 1, -1, -1): unsorted[0], unsorted[i] = unsorted[i], unsorted[0] @@ -61,4 +61,3 @@ if __name__ == '__main__': user_input = input_function('Enter numbers separated by a comma:\n') unsorted = [int(item) for item in user_input.split(',')] print (heap_sort(unsorted)) -