Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created October 20, 2019 05:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/2e3248ea427046acbb4a8d854f86908f to your computer and use it in GitHub Desktop.
Save codecademydev/2e3248ea427046acbb4a8d854f86908f to your computer and use it in GitHub Desktop.
Codecademy export
#Write your function here
def double_index(lst, index):
if index >= len(lst):
return lst
else:
new_lst = lst[0:index]
new_lst.append(lst[index]*2)
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], 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment