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

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

    while left_array_index < len(left_part) and right_array_index < len(right_part):

# User Editable Region

        if left_part[left_array_index] < right_part[right_array_index]:
            array[sorted_index] = left_part[left_array_index]
            left_array_index += 1
        else :
            array[sorted_index] = right_part[right_array_index]

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36

Challenge Information:

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

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.

Here the problem was with
Instead of
‘else :’
I should have written :
‘else:’

There was a lot of instances where I had similar situation