需要帮助了解机器如何读取此代码

Need help understanding how the machine reads this code

#  Don't change the code below 
row1 = ["⬜️","⬜️","⬜️"]
row2 = ["⬜️","⬜️","⬜️"]
row3 = ["⬜️","⬜️","⬜️"]
map = [row1, row2, row3]
print(f"{row1}\n{row2}\n{row3}")
position = input("Where do you want to put the treasure? ")
#  Don't change the code above 

#Write your code below this row 

horizontal = int(position[0])
vertical = int(position[1])

map[vertical - 1][horizontal - 1] = "X" 

#Write your code above this row 

#  Don't change the code below 
print(f"{row1}\n{row2}\n{row3}")

问题:所以我想我理解这段代码通常是如何工作的,但我不确定为什么水平在“map[vertical - 1][horizo​​ntal - 1] = “X”中排在第二位 " 行。因为它是第一个索引 [0] 并且首先读取水平(在我们确定本例中的垂直行之前,水平需要首先确定列),难道水平不会先出现吗?

编辑:我寻求帮助是因为我真的不知道。我试过查看它并尝试研究它。

考虑

  • map[0] returns 与 row1 相同的对象,map[1] returns 与 row2 相同的对象,以及 map[2] returns 与 row3.
  • 相同的对象
  • 行(传统上)可视化为垂直堆栈,一个在另一个之上,与原始代码中的一行在另一行之上相同。

因此

 a_row = map[vertical - 1]
 a_value = a_row[horizontal - 1]

这可以合并为

 a_value = map[vertical - 1][horizontal - 1]

并指定特定值

 map[vertical - 1][horizontal - 1] = "X"