Question
We are going to walk you through a process that shows you the benefit of thinking about programming tasks in terms of writing functions. Over
We are going to walk you through a process that shows you the benefit of thinking about programming tasks in terms of writing functions.
-
Over the next 3 levels we are going to write a program that draws the figure shown at right which sort of looks like a jagged diamond shape.
-
If you look at this image you might recognize elements that repeat: this is a 4-sided figure, and each side is made up of some zig-zag steps.
-
We're going to break the programming down into useable parts and then use those parts as building blocks to make this more complex drawing.
-
First let's define a function that draws just one of these zig-zag steps. We've started you out with a definition of right() that you can use...
Do This:
Define a function named function drawStep() which makes the turtle move forward and left as shown.
Note: at the end the turtle should be facing the same direction it started.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started