[Tutor] exercise with classes

Tonu Mikk tmikk at umn.edu
Thu Feb 2 18:36:25 CET 2012


I am learning Python using the "Learn Python the Hard Way" book by Zed
Shaw<http://learnpythonthehardway.org/>.
 I reached exercise 42 where we learn about Python
classes<http://learnpythonthehardway.org/book/ex42.html>.
 The exercise shows a game with one class that includes all the definitions
for playing the game.  For extra credit we are asked to create another
version of this game where we use two classes - one for the room
definitions and the other for the playing the game.  I feel stumped and
don't know how to go about creating this game with two classes.

So far I have searched for info on how to pass variables from one class to
another and have been able to create a small two class program (attached).
  But I seem unable to generalize from here and apply this to the game
exercise.  What would you suggest for me to try next?

Thank you,

Tonu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120202/47d27b3b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: classes_test.py
Type: application/octet-stream
Size: 357 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/tutor/attachments/20120202/47d27b3b/attachment.obj>


More information about the Tutor mailing list