When you ask a question, don’t forget to **include a link** to the exercise or project you’re dealing with!

If you want to have the best chances of getting a useful answer quickly, make sure you **follow our guidelines** about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer!

I am not sure why my code is not correct which is following:

#Write your function here

def double_index(lst,index1):

if index1 <= len(lst) and index1 > 0:

lst[index1] = lst[index1] * 2

return lst

else:

return lst

#Uncomment the line below when your function is done

print(double_index([3, 8, -10, 12], 10))

when i check answer on this it says i need to put a check for index is too big:

here is the solution code:

#this is codeacademy code

#Write your function here

def double_index(lst, index):

# Checks to see if index is too big

if index >= len(lst):

return lst

else:

# Gets the original list up to index

new_lst = lst[0:index]

# Adds double the value at index to the new list

new_lst.append(lst[index]*2)

# Adds the rest of the original list

new_lst = new_lst + lst[index+1:]

return new_lst

#Uncomment the line below when your function is done

print(double_index([3, 8, -10, 12], 10))

if i run the both code it gives me same answer, please advise, also solution code doesnot work for negative numbers, mine does.

Still a beginner, trying to learn!