Oct-21-2020, 06:05 PM
Hi, so I am learning python , a lot of fun but I am now stuck
Let me explain:
I am working with the turtle module and I have 2 void fonctions : draw_triangle_equilateral(turtle,size) and draw_polygone(turtle,number_sides,size)
The 2 works well but my question is :
How can a have the triangle fonction to call the polygone fonction to draw a equilateral triangle ?
I don't understand how we can mix those fonctions to work togheter.
If this can help, I will copy-paste the 2 fonctions here,
def draw_triangle_equi(t,sz):
for i in range(3):
t.forward(sz)
t.left(120)
def draw_poly(t,n,sz):
for i in range(n):
t.forward(sz)
t.left(360/n)
Thanks a lot in avdance and greetings from Quebec !
Let me explain:
I am working with the turtle module and I have 2 void fonctions : draw_triangle_equilateral(turtle,size) and draw_polygone(turtle,number_sides,size)
The 2 works well but my question is :
How can a have the triangle fonction to call the polygone fonction to draw a equilateral triangle ?
I don't understand how we can mix those fonctions to work togheter.
If this can help, I will copy-paste the 2 fonctions here,
def draw_triangle_equi(t,sz):
for i in range(3):
t.forward(sz)
t.left(120)
def draw_poly(t,n,sz):
for i in range(n):
t.forward(sz)
t.left(360/n)
Thanks a lot in avdance and greetings from Quebec !