On 26/11/2007, Christina Margaret Berens <[EMAIL PROTECTED]> wrote:
> I am supposed to make a very simple gameboard where a person is to
> find the gold by moving up, down, left, or right.  I have most of the
> math worked out and am trying to place the person on the game board.
> We were to make a list of lists for the board, but to place the person
> or gold on the board, I have to change one of the spaces to a '+', but
> when I do it, it changes all the elements in that position in each
> list.
[...]

Here is something for you to try:

>>> x = [3]
>>> y = [x, x, x]
>>> print y
>>> y[1].append(2)
>>> print y
>>> print x

Does anything you see here surprise you?  Can you explain what is going on?

-- 
John.
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to