Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created October 16, 2018 20:46
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/94f2d31751b8cabea660aaecab48c568 to your computer and use it in GitHub Desktop.
Save codecademydev/94f2d31751b8cabea660aaecab48c568 to your computer and use it in GitHub Desktop.
Codecademy export
#Codecademy solution
#Write your function here
def double_index(lst, index):
if index < len(lst):
lst[index] = lst[index] * 2
return lst
#Uncomment the line below when your function is done
print(double_index([3, 8, -10, 12], 4))
#My Solution
#Write your function here
def double_index(lst, index):
if index > (len(lst) - 1):
return lst
else:
return (lst[index] * 2)
#Uncomment the line below when your function is done
print(double_index([3, 8, -10, 12], 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment