By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,335 Members | 2,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,335 IT Pros & Developers. It's quick & easy.

Reassigning 'Hello' in this nested list to say 'Goodbye'

P: 4
list3 = [1,2,[3,4,'hello']]

I know the solution to this is: list3[2][2]='goodbye'

Why is this the solution? I don't understand why that is the answer and would appreciate an explanation, thank you!
Jun 18 '18 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 10K+
P: 12,366
list3[2] is the third item in the list, which is itself a list of 3 items.

list3[2][2] is the third item in the list of the third item in the list.
Jun 18 '18 #2

P: 4
Thank you! Much clearer now
Jun 19 '18 #3

Post your reply

Sign in to post your reply or Sign up for a free account.