arrays help
Gerhard Häring
gh_pythonlist at gmx.de
Tue Mar 19 17:35:19 EST 2002
Le 19/03/02 à 18:23, Umesh Persad écrivit:
> Hi,
> I am just getting started with Python from a c/c++ and Java
> background. I am programming a game and I wanted to
> represent a gameboard by a double subscripted array.
> How do I do this in Python? Thanks,
An easy way is to use a dictionary, mapping coordinates to the "stone"
values, like this:
cord = (0, 0)
board[coord] = 'X' # put a 'X' stone on the field (0, 0)
Gerhard
--
This sig powered by Python!
Außentemperatur in München: 6.7 °C Wind: 1.1 m/s
More information about the Python-list
mailing list