List element modification


#1



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

List element modification

n = [1, 3, 5]
# Do your multiplication here
s= n[1]*5
n.append([s])

print n.


#2

So this is valid, and I see you know how to use append, which adds to lists.
But this lesson actually wants you to overwrite the second element with that result. (The result being that you multiply n[1] by five.)
So you have two options here.
You can either say that n[1] is equal to n[1] * 5, or you can say that n[1] = s since you already defined s as n[1] = 5.
I hope this helps!
Let me know if this is confusing!


#3

yes it works,
i didnt have to use append() , just your easy way n[1]= n[1]*5

thanks kyle


#4

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