CODE CHALLENGE: LISTS Double Index double_index(lst, index)

I’m trying this code but it keeps outputting NONE and I can’t understand what’s wrong with it :sob:

# This is my code: def double_index(my_list, index): if len(my_list) <= index: return my_list else: n = my_list.pop(index) return my_list.insert(index, 2*n) # This is the exercise test: print(double_index([3, 8, -10, 12], 2))

Consider what the return value is of the insert method which you are calling on the list my_list


(post deleted by author)

Hey, not sure if you can help but I’m a bit confused on this, I understand the code but with the slicing we do, we do it up to ‘index’. Doesnt that mean that we then go to the integer before that as its always up to that number. So we wouldnt be working with the number we end up changing? I know I’m obviously incorrect but an explanation would help if you can, thanks : D