[Tutor] Problem with turtle
spir
denis.spir at gmail.com
Thu Mar 11 20:11:57 CET 2010
On Thu, 11 Mar 2010 10:11:28 -0500
Marco Rompré <marcodrompre at gmail.com> wrote:
> Hi! I am relatively new to python and turtle and I really need your help.
>
> Here what I wanted turtle to do: I created a function named carré which
> would draw a square with 3 different parameters (color, size, angle).
> I did the same for a function
> named triangle that would draw an equilateral triangle with the same
> parameters
> With the help of these 2
> functions I wanted turtle to draw a yellow square then lift my pointer let a
> space and then draw a blue triangle five times in a row.
>
> Here's my code: ignore my comments
>
> def carre(taille, couleur, angle):
> "fonction qui dessine un carré de taille et de couleur déterminées"
> color(couleur)
> c=0
> while c<4:
> left(angle)
> forward(taille)
> right(90)
> c = c+1
What is angle? Define its sense in the doc string. If it's the general orientation of the "carré", then you should use it only once, at start.
> def triangle(taille, couleur, angle):
> "fonction qui dessine un triangle équilatéral de taille, de couleur et
> d'angle déterminés"
> color(couleur)
> c=0
> while c<3:
> left(angle)
> forward(taille)
> right(120)
> c = c+1
Idem.
> from dessins_tortue import *
>
> 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
Last line is mis-indented (maybe copy-paste problem).
> 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
???
Denis
________________________________
la vita e estrany
spir.wikidot.com
More information about the Tutor
mailing list