Merge sort error
I was trying to create a merge sort function in python 3 IDLE and I can't find the problem with my code that provokes the interpreter to show the error. I need Help to understand what is the problem with my code. Code: def mergesort(a,b,c): A=0 B=0 for i in range(len(a)+len(b)): if (A==len(a)): c+=b[B:] break elif (B==len(b)): c+=a[A:] break elif (a[A]<=b[B]): c[i]=a[A] A=A+1 else: c[i]=a[B] B=B+1 print (c) mergesort(list(range(10)),list(range(30,40)),[]) Error Message: Traceback (most recent call last): File "G:\STUDY FILES\EXTERNAL\COURSES\NPTEL COURSE\PYTHON STARTER\files\mergesort.py", line 18, in <module> mergesort(list(range(10)),list(range(30,40)),[]) File "G:\STUDY FILES\EXTERNAL\COURSES\NPTEL COURSE\PYTHON STARTER\files\mergesort.py", line 12, in mergesort c[i]=a[A] IndexError: list assignment index out of range