Double index




I don’t really understand the Codecademy solution to this problem - don’t you have to return the doubled value in order to print anything? And how does this code know to return the original list if the condition (i.e. index < eln(lst)) isn’t met? My code is below and seems to work also… but would love to know how the shorter more elegant code works! Any help much appreciated!


Your program returns only the doubled value, not the modified list.

return (lst[index] * 2)


Ahhh hadn’t read the question properly! Thanks very much :slight_smile: