SyntaxFix
Write A Post
Hire A Developer
Questions
l.insert(index, obj) doesn't actually return anything. It just updates the list.
l.insert(index, obj)
As ATO said, you can do b = a[:index] + [obj] + a[index:]. However, another way is:
b = a[:index] + [obj] + a[index:]
a = [1, 2, 4] b = a[:] b.insert(2, 3)