Y I'm getting none as output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Y I'm getting none as output

Merge sort https://code.sololearn.com/cY60Mx5W4l9t/?ref=app

4th Apr 2021, 10:51 AM
Shivam Rawal
5 Answers
+ 2
Shivam, Code requires little change In merge() function Condition needs to be corrected if not (len(left) or len(right)): one parenthesis will make every thing in order. In merge sort it first divides list into halves each iteration till it becomes empty, after that it merges divided lists with sorting till sorted single list. Hope this will it clear rest of the part is correct.
4th Apr 2021, 11:49 AM
DHANANJAY PATEL
DHANANJAY PATEL - avatar
+ 2
Shivam, Another change required is indentation in merge_sort() function, all the code bellow if statement is not indented correctly Indentation is big problem with python with it code cannot work as intended.
4th Apr 2021, 12:12 PM
DHANANJAY PATEL
DHANANJAY PATEL - avatar
+ 1
Because all your main code of merge_sort in if len<2
4th Apr 2021, 11:51 AM
Илья Мирошник
Илья Мирошник - avatar
0
Tysm
4th Apr 2021, 12:35 PM
Shivam Rawal
0
I did it tysm for helping
4th Apr 2021, 12:36 PM
Shivam Rawal