What am I doing wrong here? List element modification


#1


https://www.codecademy.com/courses/python-beginner-nzzVa/0/2?curriculum_id=4f89dab3d788890003000096

I keep get the following error message which stops me progressing to the next exercise:

Oops, try again.
Did you remember to multiply the second element in the list by 5?

However, on my printed screen I get 15 (which is correct - second element * 5) so my code is working. What have I done wrong?


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


#2

the output you should get:

[1,15,5]

the output you get:

15

you removed the whole list. You should update the second item, any idea how to achieve this? Ask if you need for more help, but first try to figure it out yourself. If you ask for more help, also be specific on what you don't understand


#3

Oh I see! I didn't quite twig they wanted the whole list with the middle *5 I thought it wanted just the answer to n[1] * 5

So the code would be:

n = [1, 3, 5]

n[1] = n[1] * 5

Print n

It works now!

Thank you.

Output was [1, 15, 5]