[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 Shaw. I reached exercise 42 where we learn about Python classes. The exercise shows a game with one class that includes all the definitions fo

Re: [Tutor] exercise with classes

2012-02-09 Thread Tonu Mikk
On Mon, Feb 6, 2012 at 12:58 PM, Dave Angel 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

Re: [Tutor] exercise with classes

2012-02-06 Thread Tonu Mikk
ing > like: > 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 wrote: > > Alan, thanks for explaining about passing objects to classes. This is an > >

Re: [Tutor] exercise with classes

2012-02-06 Thread Tonu Mikk
: > 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 gam

[Tutor] exercise with classes

2012-02-02 Thread Tonu Mikk
I am learning Python using the "Learn Python the Hard Way" book by Zed Shaw. I reached exercise 42 where we learn about Python classes. The exercise shows a game with one class that includes all the definitions fo

Re: [Tutor] using a for loop with feedparser

2009-01-27 Thread Tonu Mikk
Kent, you are absolutely correct. I did not need the line number 5 at all. This was my first program that addressed a "real life" scenario. I am excited that it worked. Thank you, Tonu Kent Johnson wrote: On Mon, Jan 26, 2009 at 4:53 PM, Tonu Mikk wrote: I now have a ne

Re: [Tutor] using a for loop with feedparser

2009-01-26 Thread Tonu Mikk
t;, but both of them 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

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

[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 inser

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) time.sl

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. > &g

Re: [Tutor] Livewires - stuck on a class

2007-08-14 Thread Tonu Mikk
x in robots: > to become... > for robot in robots: > > Thank you! This did the trick. 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-29 Thread Tonu Mikk
Luke Paireepinart wrote: >> >> >> Sure, sure. I'm glad it at least ran. I don't have livewires >> installed so I wasn't able to test any of the code I wrote. >> >> Thanks again for your help. If you have suggestions on the 't' key, >> please share them. This seems to be the one issue p

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

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:

Re: [Tutor] Livewires questions

2007-07-26 Thread Tonu Mikk
got it. I will do it like this: def collided(): return (player_x == robot_x+0.5 and player_y == robot_y+0.5) Thank 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
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. >

[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 (http://www.livewires.org.

[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 interactiv

[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 a