Mar-10-2020, 04:20 AM
(This post was last modified: Mar-10-2020, 04:20 AM by deanhystad.)
To draw 5 stick figure you could do something like this:
Then next thing is figure out how to write a loop. You have a loop in you code that would draw an additional two stick figures if you hadn't already called turtle.done(). How could you make that loop execute 5 times?
def main(): """Draw stick figures, side by side""" turtle.pensize(4) turtle.title("Stick Figures") turtle.up() turtle.back(200) draw_stick_figure() turtle.forward(100) draw_stick_figure() turtle.forward(100) draw_stick_figure() turtle.forward(100) draw_stick_figure() turtle.forward(100) draw_stick_figure() turtle.forward(100) turtle.done()This draws five stick figures. What instructions were repeated five times? Those instructions are what you want to execute in the loop, nothing more and nothing less.
Then next thing is figure out how to write a loop. You have a loop in you code that would draw an additional two stick figures if you hadn't already called turtle.done(). How could you make that loop execute 5 times?