94.1k views
2 votes
Define a python functions that draw a pinwheel using the pinwheel function that has input paramiters that allows you to change the number of branches and size

then make on that does not use the pinwheel function to draw it

User LightBox
by
5.0k points

1 Answer

5 votes

Start with your draw_pinwheel() function

During each iteration of the loop decide which color to set the turtle to using the color() function

On even iterations, use color1

On odd iterations, use color2

Use an if/else statement to do the decision making

After deciding the color, surround a call to draw_triangle() with begin_fill() and end_fill() so that drawing the triangle creates a colored triangle.

If you have have forgotten, you can use an if/else to check for even/oddness in python as follows.

my_number = 3

if(my_number % 2 == 0): # the remainder of dividing by 2 is 0

print("The number is "+str(my_number))

print("The number is EVEN")

else: # the remainder must be 1

print("The number is "+str(my_number))

print("The number is ODD")

Good luck <3

User Howl
by
5.1k points