列表超出范围(地图)

时间:2019-05-26 02:41:03

标签: python python-3.x

在python 3.7中,我的列表超出了地图的范围,并且我尝试了多种方法来修复它。 (这是我正在制作的Oregon Trail游戏)

我试图更改最大x和最大y

trail = [[1 for x in range(maxx)]for y in range(maxy)]
trail [25][2] = "Fort Kearney"
trail [26][2] = "St. Joseph"
trail [24][2] = "Ash Hollow"
trail [22][2] = "Chimney Rock"
trail [22][2] = "Fort Laramie"
trail [29][2] = "Independence Rock"
trail [27][2] = "Fort Bridger"
trail [24][2] = "Sublette Cutoff"
trail [23][2] = "North Platte River Crossing"
trail [23][2] = "Fort Hall"
trail [22][2] = "Snake River Crossing"

我遇到了错误_

/Python/Python37-32/oregontrail.py", line 15, in <module>
    trail [25][2] = "Fort Kearney"
IndexError: list index out of range
>>>

0 个答案:

没有答案