[Tutor] Problem with turtle

Vern Ceder vceder at canterburyschool.org
Thu Mar 11 20:53:37 CET 2010


Ooops... missed a closing parenthese... that should be:

for n in range(10):
      <square and triange code here...>

Vern Ceder wrote:
> It looks like the indentation of n = n + 1 is wrong - it will be outside 
> of the while loop and so n will never increment and the loop will never 
> end.
> 
> Instead of a while loop I would suggest a for loop:
> 
> for n in range(10:
>     <square and triange code here...>
> 
> HTH,
> 
> Vern
> 
> Marco Rompré wrote:
>> I wanted turtle to draw alternatively a square and a triangle with a 
>> space between them each with a specific color, angle(orientation as 
>> you said), size. Instead, turtle was drawing a yellow square then it 
>> was drawing a triangle on the sqare but with no lines whatsovever like 
>> it was just going over it and the last problem was that it was never 
>> stopping and i had to rstart the shell to make it stop.
>>
>> I hope I am more precis with my explanations.
>>
>> Thanks for helping me learn
>>
>> On Thu, Mar 11, 2010 at 1:26 PM, Alan Gauld <alan.gauld at btinternet.com 
>> <mailto:alan.gauld at btinternet.com>> wrote:
>>
>>
>>     "Marco Rompré" <marcodrompre at gmail.com
>>     <mailto:marcodrompre at gmail.com>> wrote
>>
>>
>>         Hi! I am relatively new to python and turtle and I really need
>>         your help.
>>
>>
>>     Thats what we are hee for but....
>>
>>
>>         Here's my code: ignore my comments
>>
>>
>>     n=0
>>     while n < 10 :
>>       down()                         # abaisser le crayon
>>       carre(25, 'yellow', 0)         # tracer un carré
>>       up()
>>       forward(30)
>>       triangle(90, 'blue',0)
>>     n = n + 1
>>
>>
>>         If I am to vague I wanted to do successfully exercise 7.6 in
>>         Gérard Swinnen
>>         tutorial for Python
>>
>>         It was supposed to look like this
>>
>>
>>     So what happens? Is there an error message or does it just draw
>>     the wrong thing? Don't make us guess...
>>
>>
>>
>>     --     Alan Gauld
>>     Author of the Learn to Program web site
>>     http://www.alan-g.me.uk/
>>
>>     _______________________________________________
>>     Tutor maillist  -  Tutor at python.org <mailto:Tutor at python.org>
>>     To unsubscribe or change subscription options:
>>     http://mail.python.org/mailman/listinfo/tutor
>>
>>
>>
>>
>> -- 
>> Marc-O. Rompré
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
> 

-- 
This time for sure!
    -Bullwinkle J. Moose
-----------------------------
Vern Ceder, Director of Technology
Canterbury School, 3210 Smith Road, Ft Wayne, IN 46804
vceder at canterburyschool.org; 260-436-0746; FAX: 260-436-5137

The Quick Python Book, 2nd Ed - http://bit.ly/bRsWDW


More information about the Tutor mailing list