Https://www.codecademy.com/courses/learn-python-3/lessons/python-functions-lists-cc/exercises/double-index

def double_index(lst, index):
if index >= len(lst):
return lst
else:
before_index_element = lst[:index]
double_of_element = [2*lst[index]]
after_the_element = lst[index+1:]
new_lst = str(before_index_element + double_of_element + after_the_element)
return (new_lst)

Hi, my answer is coming out right but still it’s showing " Double the value at position index in lst" error and has wronged the code(showing a cross).

What do you think of this?

Same problem as in this topic? I know its a different exercise, but the problem appears the same

Yeah, the code works fine. Gives the expected answer but showing the error below the writing space. On the right side, no error shown.

Here also, removing str did the work. :slight_smile:

1 Like