mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
Simplify code by dropping support for legacy Python (#1143)
* Simplify code by dropping support for legacy Python * sort() --> sorted()
This commit is contained in:
@ -10,9 +10,6 @@ For manual testing run:
|
||||
python heap_sort.py
|
||||
'''
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
def heapify(unsorted, index, heap_size):
|
||||
largest = index
|
||||
left_index = 2 * index + 1
|
||||
@ -54,11 +51,6 @@ def heap_sort(unsorted):
|
||||
return unsorted
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
raw_input # Python 2
|
||||
except NameError:
|
||||
raw_input = input # Python 3
|
||||
|
||||
user_input = raw_input('Enter numbers separated by a comma:\n').strip()
|
||||
user_input = input('Enter numbers separated by a comma:\n').strip()
|
||||
unsorted = [int(item) for item in user_input.split(',')]
|
||||
print(heap_sort(unsorted))
|
||||
|
Reference in New Issue
Block a user