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
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
...@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
:
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
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
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
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
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
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)
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
.
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
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
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
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
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
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
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
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
18 matches
Mail list logo