Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Elfar Oliver](https://secure.gravatar.com/avatar/04979abb0c28802b79c5e40329d00f93?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Elfar Oliver
3,924 PointsThe last was 32 but then we changed the value of [2](which is the last one) to 20 and it was still 32. Any reason why?
csharp> lockCombination[2] = 20;
csharp> last
32
csharp> lockCombination
{ 10, 5, 20 }
1 Answer
![Caleb Kemp](https://secure.gravatar.com/avatar/b9fd177622323bbdb83c44542f65a7ec?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Caleb Kemp
12,754 PointsSo the first thing that can be tricky is, if you have [2]
it is actually referring to the third item in the list. so for list [0, 5, 17]
, list[2]
would be 17. But, unless I'm mistaken, the part that is giving you trouble is that you have two different variables here. One named last
, with a value of 32
, and one called lockCombination
. When you wrote
csharp> lockCombination[2] = 20;
it did indeed change the value of lockCombination[2]
to 20. You can see that by looking at the value of the third value of your output
csharp> lockCombination { 10, 5, 20 }
however, this did not change the value of last
, so it is still 32. If you wanted to also change the value of last
to 20, you would need to write something like last = 20;
Hope that helps.