List Element Modification


#1



My code keeps telling me, "Opps, try again.Did you remember to multiply the second element in the list by 5"


In the console it gives my 15 and that is what its supposed to do! I times 3 by 5, so why isn't it letting me continue on?


n = [1, 3, 5]
# Do your multiplication here
n= n[1]*5
print n


#2

because you overwrite your entire list with the second item multiplied by 5? look at this example:

n = [9, 6, 3]
n[0] = n[0] +3

see how i only update the item at index 0? by just using n like you did, you will overwrite the list with just a number (integer)


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.