You blew your indentation. Here’s the correct version:
def mergeSort(mylist):
if len(mylist) <= 1:
return mylist
mid = len(mylist) // 2
left = mergeSort(mylist[:mid])
right = mergeSort(mylist[mid:])
return merge(left,right)
In the version you posted, you have the main body of the routine still inside the if statement, but after the return. This means that it can never execute. If you look, you should find that your program did print something, the value None.
solved Function output not printing? [closed]