Sounds like an excuse for a global (aggh!) variable. Or more properly, wrap all of the relevant functions in a class and use a class variable for your puzzle
----- Original Message ----- From: "Devon MacIntyre" <[EMAIL PROTECTED]> To: <tutor@python.org> Sent: Wednesday, November 28, 2007 4:00 PM Subject: [Tutor] Variables and Functions > Hi, > Just wondering, how would I get a variable out of one function and into > another? I'm trying to make a Sudoku puzzle for Python 2.5.1, and in one > function I have the finished puzzle (as a matrix) called 'puzzle'. Using > the > 'copy' module I made a deep copy called 'new_puzzle'. That function is > called to create the puzzle and its duplicate, because new_puzzle gets > changed so that 85% of the numbers in the matrix get replaced by an empty > string. Now, I have another function that allows you to choose the where > on > the grid to put in the number, but I also need to get new_puzzle in that > function to add numbers not only on the Turtle grid, but add them in > new_puzzle so I can compare it with the original 'puzzle' variable. > > PS: Both functions 'new_sudoku()' and 'play_game()' are called by a > function > called 'new_game()'. Also, I'm using a Mac, but I'm not sure if that > affects > the code or not. > > Thanks in advance. > -------------------------------------------------------------------------------- > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor