wordList is a list of words that currently contains the values ["tree", "rock", "air"]
Which of the following lines will result in the list containing the values ["air", "rock", "air"]
A. wordList[0] = wordList[2]
B. wordList[2] = wordList[O]
C.insertitem(wordList, O, "air")
D. removeltem(wordList,0)

Respuesta :

Answer:

A. wordList[0] = wordList[2]

Explanation:

Required

Which line would give ["air", "rock", "air"]

From the question, we have that:

wordList =  ["tree", "rock", "air"]

which means that:

wordList[0] = "tree"

wordList[1] = "rock"

wordList[2] = "air"

Analyzing the options.

A. wordList[0] = wordList[2]

This will assign the item in wordList[2] to wordList[0].

and the result would be

So:

wordList[0] = "tree"

would change to

wordList[0] = "air"

The new content of wordList would then be ["air", "rock", "air"]

Option (A) answers the question

fichoh

The list variable wordList contains three string values, Hence, to obtain the list, ["air", "rock", "air"], the lines wordList[0] = wordList[2] would be used.

  • List values are indexed from 0 ; hence, tree = index 0 ; rock = index 1 ; air = index 2

  • To assign the the string "tree" to index 0, then wordList[2] is assigned to wordList[0].

  • wordList[0] is now "air"

Hence, the required line of code would be wordList[0] = wordList[2]

Learn more :https://brainly.com/question/19117781