def swap(i, j):
    sqc[i], sqc[j] = sqc[j], sqc[i]

def heapify(end, i):
    l = 2 * i + 1
r = 2 * (i + 1)
max = i
if l < end and sqc[i] < sqc[l]:
    max = l
if r < end and sqc[max] < sqc[r]:
    max = r
if max != i:
    swap(i, max)
heapify(end, max)

def heap_sort():
    end = len(sqc)
start = end // 2 - 1
for i in range(start, -1, -1):
    heapify(end, i)
for i in range(end - 1, 0, -1):
    swap(i, 0)
heapify(i, 0)
sqc = [2, 7, 1, -2, 56, 5, 3]
heap_sort()
print(sqc)
Heap Sort: how to sort?