Consider the following code:


grid = []


grid.append (["frog", "cat", "hedgehog"])

grid.append (["fish", "emu", "rooster"])

What is output by:


print (grid[0][0])
also these two
print (grid[1][2])
print (grid[0][1])

Respuesta :

Answer:

print(grid[0][0]) = frog

print(grid[1][2]) = rooster

print(grid[0][1]) = cat

Final output:

frog

rooster

cat

Explanation:

grid[0][0] is the first item in grid[0], which is "frog".

grid[1][2] is the last/third item in grid[1], which is "rooster".

grid[0][1] is the second item in grid[0], which is "cat".

Simply add 1 when dealing with list indexes, that's all you need to do!

In Python, the list is a mutable, or changeable, ordered series containing elements. so, the output of the given python program code is "frog, rooster, and cat".

Program explanation:

  • Defining an empty list that is a "grid".
  • Inside the list, the append method is declared which adds string value to the list.
  • In the next line, three print method is used that calls the list values.
  • In the first print method, it calls the first index value "0,0" which is "frog".
  • In the second print method, it calls the second index value "1,2" which is "rooster".
  • In the third print method, it calls the first index value "0,1" which is "cat".

Output:

Please find the attached file.

Find out more about the list in python here:

brainly.com/question/17019263

Ver imagen codiepienagoya