Skip to content

Heap Sort + tests#4

Open
stuffacc wants to merge 2 commits intomainfrom
t5
Open

Heap Sort + tests#4
stuffacc wants to merge 2 commits intomainfrom
t5

Conversation

@stuffacc
Copy link
Owner

No description provided.

arr = [1, 2, 3, 4, 5]
heap_sort(arr)

assert arr == [1, 2, 3, 4, 5]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему бы не написать arr == sorted(arr)?

Comment on lines +27 to +32
arr = [4, 10, 3, 5, 1, 10, 4, 23, 2, 3, 2, 24, -1, -51, -1, 25]

print(arr)
heap_sort(arr)
print(arr)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не знаю, учили вас этому или нет, но на питоне принято делать так:

Suggested change
arr = [4, 10, 3, 5, 1, 10, 4, 23, 2, 3, 2, 24, -1, -51, -1, 25]
print(arr)
heap_sort(arr)
print(arr)
if __name__ == '__main__':
arr = [4, 10, 3, 5, 1, 10, 4, 23, 2, 3, 2, 24, -1, -51, -1, 25]
print(arr)
heap_sort(arr)
print(arr)

Это нужно, чтобы этот код не исполнялся, когда Вы импортируете этот файл как модуль.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants