Learn Data Structures by Building the Merge Sort Algorithm - Step 11

Tell us what’s happening:

Describe your issue in detail here.

Your code so far

def merge_sort(array):
    
    middle_point = len(array) // 2
    left_part = array[:middle_point]
    right_part = array[middle_point:]

    merge_sort(left_part)
    merge_sort(right_part)

    left_array_index = 0
    right_array_index = 0
    sorted_index = 0


# User Editable Region

    While True:
        if left_part < right_part:
            merge_sort(left_part)
            if left_array_index < len(left_part):
                pass
        else:
            merge_sort(right_part)
            if right_array_index < len(right_part):
                pass

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36

Challenge Information:

Learn Data Structures by Building the Merge Sort Algorithm - Step 11

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.
Learning to describe problems is hard, but it is an important part of learning how to code.
Also, the more you say, the more we can help!

Hi @abdoulayeaffadinebra

You have:

    While True:
        if left_part < right_part:
            merge_sort(left_part)
            if left_array_index < len(left_part):
                pass
        else:
            merge_sort(right_part)
            if right_array_index < len(right_part):
                pass

The request says:

Create two conditions for the loop:

I know that’s quite unambiguous but it expects you to understand that it is talking about the condition of the loop and not the content inside the loop block, which is what you have.
In other words:

while condition one and condition two:
    pass

Or in this case:

while something < something_else and another_something < another_else :
    pass

By the way, Python is case sensitive in its keywords, which means that While would not be the same than while

while needs to be lowercase

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.