Here's the corrected code:
```
def merge_sort(my_list):
if len(my_list) > 1:
mid = len(my_list)//2
left_half = my_list[:mid]
right_half = my_list[mid:]
merge_sort(left_half)
merge_sort(right_half)
i = j = k = 0
while i < len(left_half) and j < len(right_half):
if left_half[i] < right_half[j]:
my_list[k] = left_half[i]
i += 1
else:
my_list[k] = right_half[j]
j += 1
k += 1
while i < len(left_half):
my_list[k] = left_half[i]
i += 1
k += 1
while j < len(right_half):
my_list[k] = right_half[j]
j += 1
k += 1
my_list = [35,22,90,4,50,20,30,40,1]
merge_sort(my_list)
print(my_list)
```
The code defines a merge_sort function that sorts a list using the merge sort algorithm. It takes one parameter: my_list, which is the list to be sorted. If the length of the list is greater than 1, it splits the list into two halves, left_half and right_half, and recursively calls merge_sort on each half. Then, it initializes three pointers i, j, and k to 0. It loops through both halves of the list and compares elements from both halves. If an element from the left half is smaller than an element from the right half, it assigns the element from the left half to the current position in the list and increments the i pointer. Otherwise, it assigns the element from the right half to the current position in the list and increments the j pointer. It also increments the k pointer after each assignment. After the loop finishes, it checks if there are any remaining elements in either half of the list and assigns them to the remaining positions in the list. Finally, it returns the sorted list. The code creates a list my_list, calls the merge_sort function with it, and prints the sorted list.