它不想打印出用户输入的列表。我认为问题出在list = []
中from HeapClass import Heap
def minHeap(list):
heap = Heap() #
lst = eval(input("Enter list of numbers: "))
for v in lst:
heap.add(v)
for i in range(len(list)):
list[len(list) - 1 - i] = heap.remove()
def main():
list = [] This think the problem is here because it doesn't return a list but when I write list = lst... It does not work either
minHeap(list)
for v in list:
print(str(v)+ " ", end = " ")
main()