[Tutor] exercise with classes 2nd attempt

2012-02-11 Thread Tonu Mikk
I am learning Python using the Learn Python the Hard Way book by Zed Shawhttp://learnpythonthehardway.org/. I reached exercise 42 where we learn about Python classeshttp://learnpythonthehardway.org/book/ex42.html. The exercise shows a game with one class that includes all the definitions for

Re: [Tutor] exercise with classes

2012-02-09 Thread Tonu Mikk
On Mon, Feb 6, 2012 at 12:58 PM, Dave Angel d...@davea.name wrote: On 02/06/2012 01:24 PM, Tonu Mikk wrote: Now I get an error: NameError: global name 'self' is not define. Tonu Put your remarks after the stuff you quote. You're top-posting, which makes the reply difficult to follow

Re: [Tutor] exercise with classes

2012-02-06 Thread Tonu Mikk
...@btinternet.comwrote: On 02/02/12 17:36, Tonu Mikk wrote: 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

Re: [Tutor] exercise with classes

2012-02-06 Thread Tonu Mikk
: def dolt(self): # Do stuff. For more info on the self keyword, see http://docs.python.org/tutorial/classes.html, section 9.3.2. On 2/6/12, Tonu Mikk tm...@umn.edu wrote: Alan, thanks for explaining about passing objects to classes. This is an important concept for me to understand

[Tutor] exercise with classes

2012-02-02 Thread Tonu Mikk
I am learning Python using the Learn Python the Hard Way book by Zed Shawhttp://learnpythonthehardway.org/. I reached exercise 42 where we learn about Python classeshttp://learnpythonthehardway.org/book/ex42.html. The exercise shows a game with one class that includes all the definitions for

[Tutor] using a for loop with feedparser

2009-01-26 Thread Tonu Mikk
Hello, I am trying to parse a feed and insert some feed elements into a Django project database. I believe I should be able to use for loop to iterate over the list elements. I am using the Universal Feed parser (http://www.feedparser.org/). I am able to extract items one by one and

Re: [Tutor] using a for loop with feedparser

2009-01-26 Thread Tonu Mikk
Tonu Mikk wrote: Hello, I am trying to parse a feed and insert some feed elements into a Django project database. I believe I should be able to use for loop to iterate over the list elements. I am using the Universal Feed parser (http://www.feedparser.org/). I am able to extract items

Re: [Tutor] using a for loop with feedparser

2009-01-26 Thread Tonu Mikk
generated errors. I am not quite sure where to go from here. Thank you, Tonu Tonu Mikk wrote: Tonu Mikk wrote: Hello, I am trying to parse a feed and insert some feed elements into a Django project database. I believe I should be able to use for loop to iterate over the list elements. I am

Re: [Tutor] Livewires

2007-09-10 Thread Tonu Mikk
Hi Sacha, I am very much a beginner to Python myself, but I tried my hand on the Livewires modules. Here is how I solved the challenge. from livewires import * begin_graphics() allow_moveables() x=0 y=0 c = circle(x, y,5) while x 640: x=x+5 y=y+3.822 move_to (c, x, y)

Re: [Tutor] Livewires - stuck on a class

2007-08-15 Thread Tonu Mikk
Alan Gauld wrote: Tonu Mikk [EMAIL PROTECTED] wrote I create more robots in this way which seems to work: class Robot: pass By using an empty class you are losing m,uch of the power of classes. I would need to learn more to handle the classes better. In this case, I am

Re: [Tutor] Livewires - stuck on a class

2007-08-14 Thread Tonu Mikk
. Tonu -- Tonu Mikk Educational Technology Consultant Digital Media Center - dmc.umn.edu [EMAIL PROTECTED] 612 625-9221 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Livewires questions

2007-07-27 Thread Tonu Mikk
Luke Paireepinart wrote: def place_robot(): global robot_x global robot_y global robot_shape robot_y = random_between(0,47)-0.5 robot_x = random_between(0,63)-0.5 I'm not too clear why you're subtracting 0.5 here. Doesn't this make the robot's center on the grid

Re: [Tutor] Livewires questions

2007-07-26 Thread Tonu Mikk
you, Tonu -- Tonu Mikk Educational Technology Consultant Digital Media Center - dmc.umn.edu [EMAIL PROTECTED] 612 625-9221 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Livewires questions

2007-07-26 Thread Tonu Mikk
Eric Brunson wrote: Tiger12506 wrote: Based on your guidance, I figured it out. I need to use a return statement, which I had not encountered before. Now I wrote my definitions in this way: def collided(): if player_x == robot_x+0.5 and player_y == robot_y+0.5: return True

Re: [Tutor] Livewires questions

2007-07-26 Thread Tonu Mikk
service! Luke Paireepinart wrote: Tonu Mikk wrote: Thanks for offering to help! I am following the Livewires exercise (attached file 5-robots.pdf). I have gotten as far as page 7. Attached is also my code so far in robotsarecoming-teleport.py. Question 1. I was checking for collision

[Tutor] Livewires Python course

2007-07-25 Thread Tonu Mikk
Hello, I am at a very beginning on trying to learn Python. So far I have read first few chapters of Alan Gauld tutorials, and completed all the exercises of Guido van Robot (http://gvr.sourceforge.net/). I also began reading and coding the Livewires course exercises

[Tutor] how to run a text file in an interpreter?

2007-03-30 Thread Tonu Mikk
Hello, I am new to the list and to programming in general. I want to learn Python as I find it an interesting language. I also support an application that is written in Python called Roundup http://roundup.sf.net . I find that I would like to make small tweaks to the program that require

[Tutor] how to run a text file in an interpreter?

2007-03-30 Thread Tonu Mikk
I started reading Instant Python tutorial ( http://hetland.org/writing/instant-python.html ) and came across this section: /Note:/ To get the examples working properly, write the programs in a text file and then run that with the interpreter; do /not/ try to run them directly in the