Answered step by step
Verified Expert Solution
Link Copied!

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 1000,1000
Create a new turtle object, naming it whatever you like.
Using a for loop and range() function, iterate a random number of times between 4 and 10.
For each iteration of the loop:
a. select a random color and store in a variable named my_color
You can use the following list for your colors: color_list =["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 my_color variable from the previous step as an argument.
c. Move the turtle to a random location
Note: you'll need to generate random x and y coordinates between -400 and 400
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 x 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 non-regular shapes (like a cat, stick figure, house, etc.)
Output Example:
Note: In this example, I'm generating random shapes. You do not have to generate random shapes. Yours can be all the same.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Which are non projected Teaching aids in advance learning system?

Answered: 1 week ago