List Practice Problem 12

Screen Link:

My Code:

def insert(some_list, obj, idx):
    return some_list[:idx] + [obj] + some_list[idx+1:]

What I expected to happen:
[Obj] is supposed to enter [idx]. Then the second some_list is supposed to begin from [idx + 1].

What actually happened:

Replace this line with the output/error

It seems okay what is the issue? And also provide Screen link.

def insert(some_list, obj, idx):
return some_list[:idx] + [obj] + some_list[idx]

This is the correct answer by this platform.

Here your code will replace item instead pushing it to right as said in instruction.

def insert(some_list, obj, idx):
    return some_list[:idx] + [obj] + some_list[idx+1:]

For example:

lst = [1, 2, 3]
insert(lst, 22, 1)

This will give output
[1, 22, 3]

instead of [1, 22, 2, 3]

So use this code.