lists. Putting it all together…Plzz notice me… just want to ask if in every exercise the only code that runs are the code that was asked in the instruction?? because i was trying to add code from previous step on the topic but i coudnt see changes in the right panel… plzz tell, my code is like this
comicStrip=['Codey sees the trail' , 'Codey starts the hike' , 'Codey is halfway' , 'Codey reaches the finish']
comicStrip.pop()
That line will shorten the list but nothing is logged to the console. In this exercise we don’t want to destroy or mutate the list as much as poll one of the elements.
‘po’ is a word we filipino use to show respect to other people… Sorry for using it here,…
well i am expecting that in this exercise ‘Putting it all together’, i can use all what i have learn in the List topic, like adding a list, removing a list, through the code i write but it comes out that it seems the ‘computer’ didnt read my console coz it didnt show on the right panel the output i am expecting and i guess my code is correct.
i hope you understand po coz im not so good in explaining what i mean,
Correct is not the word I would use unless two things can be counted upon…
Given we are looking for the fourth element in the list, it would have to be the last one in order for .pop() to be able to extract it; and,
the output is logged so we can see it on the display.
The other condition would be that it doesn’t matter what happens to the original list. .pop() mutates the list so anything that is popped from the list will no longer be in the original.
In this particular problem, given we are instructed to extract the fourth element of a list that we don’t know the length of (let’s say) then to most direct and non-presumptive approach would be to use the subscripted index, [3].