[Tutor] Livewires

sacha rook sacharook at hotmail.co.uk
Mon Sep 10 13:29:24 CEST 2007


Hi all
 
just learning python really and been using the livewires tutorial / worksheets to get some experience.
 
I have hit an issue which is just my lack of understanding around looping concepts and execution.
 
My issue:
 
in worksheet 5-robots.pdf attached, page 4 the challenge
 
"Challenge: Write a loop that makes the circle move smoothly from (0,0) to (640,480): in other words, from the bottom leftto the top right of the screen."
 
this has got me a bit stumped because its an (x,y) co-ordinate pair that I want to update.
I think in a loop i need to draw a circle, move a circle, remove the circle.
 
I thought I needed to for loops to iterate through two ranges but this is wrong, here is my code though!
 
from livewires import *begin_graphics()
 allow_moveables()x=range(10,640,10)y=range(10,480,10)
for xco in x:    for yco in y:        c = circle(xco,yco,5)        move_to(c, xco,yco)#        remove_from_screen(c) /*commented this out to see output on graphics window */end_graphics()
 
Can anyone look at the worksheet challenge and my poor code and show me the error of my ways? :)
I appreciate it may be my inexperience in program flow/logic which is the problem also, I don't my help or suggestion to improve in any area.
Thanks for your help in advance
Sacha
 
 
_________________________________________________________________
The next generation of MSN Hotmail has arrived - Windows Live Hotmail
http://www.newhotmail.co.uk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070910/9f0f42b4/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 5-robots.pdf
Type: application/pdf
Size: 89940 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tutor/attachments/20070910/9f0f42b4/attachment-0001.pdf 


More information about the Tutor mailing list