Problemas
3. wordList is a list of words that currently contains the values ["tree","rock","air'l Which of the following lines will result in the list containing the values ["air", "rock","airl A. wordList[O]=wordList[2] B. wordList[2]=wordList[0] C. insertitem(wordList,0,''air'') D. removeltem(wordList,0)
Roztwór
Sergio
élite · Tutor durante 8 años
4.4
(325 Votos)
Respuesta
The correct answer is C.
.Explanation:The initial value of the wordList is ["tree", "rock", "air"]. To change the list to ["air", "rock", "air"], we need to insert the word "air" at the beginning of the list.Option A:
will replace the first element with the third element, resulting in ["rock", "rock", "air"], which is not the desired output.Option B:
will replace the third element with the first element, resulting in ["tree", "rock", "tree"], which is not the desired output.Option C:
will insert the word "air" at the beginning of the list, resulting in ["air", "rock", "air"], which is the desired output.Option D:
will remove the first element from the list, resulting in ["rock", "air"], which is not the desired output.Therefore, the correct answer is option C.