2015-11-18 116 views
0

我無法弄清楚...爲什麼這不起作用?Python:列表索引超出範圍?

線20,在placeBoat boatCoordinates = [xBoat] [yBoat] IndexError:列表索引超出範圍

def placeBoat(): 
    xBoat = randint(1,9) 
    yBoat = randint(1,9) 
    boatCoordinates = [xBoat][yBoat] 

回答

0
def placeBoat(): 
    return (randint(1,9) , randint(1,9) ,)