Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Coding: In your file, import the turtle and random modules Create a screen object and set the height and width to 1 0 0 0
Coding:
In your file, import the turtle and random modules
Create a screen object and set the height and width to
Create a new turtle object, naming it whatever you like.
Using a for loop and range function, iterate a random number of times between and
For each iteration of the loop:
a select a random color and store in a variable named mycolor
You can use the following list for your colors: colorlist red "blue", "green", "yellow",
"purple", "orange", "black", "white"
You'll need to do some additional research on different random functions. See link above.
b Set the turtle's fill color using the mycolor variable from the previous step as an argument.
c Move the turtle to a random location
Note: you'll need to generate random and coordinates between and
Make sure you pick up the pen and put it back down before you move.
You may need to research how to move the turtle to different coordinates.
d Draw a shape of your choosing. It can be a simple triangle, square, or any other shape you wish. Note: See SBS
assignment for examples of this
It must be a closed shape.
You can use a loop to create it if you want this is a nested loop and we cover it more in depth later,
but you don't have to do it now...
It must be filled in
It must use a named constant for the length of each side if it's a regular shape
Note: If you create a custom shape, the constant is not needed
The drawing must be kept open until clicked or closed with button.
Note: be careful not to put this code inside of your for loop. It should be the last line of code and all the way to
the left side of the screen
You may want to try these optional items:
a Generating random shapes
b Adding Random sizes
c Creating nonregular shapes like a cat, stick figure, house, etc.
Output Example:
Note: In this example, Im generating random shapes. You do not have to generate random shapes. Yours can be all the same.
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