Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need some help with turtle lab assignment Paython language, loop condition Turtle Lab #3 Drawing Circles In this section of the lab you will
I need some help with turtle lab assignment Paython language, loop condition
Turtle Lab #3 Drawing Circles In this section of the lab you will create code that will draw a series of 4 circles. Each circle will be in a different part of the screen, have a different pen size and be a different color. To move the circles and change the color we will use a for loop and an array for the colors We will use the following methods in this portion of the lab penup() pendown() - goto) fillcolor() pensize() begin fill() .end_fill() -circle() Follow these steps to create your circles 1. Open up IDLE and open a new window. Save this file as DrawingCircles.py 2. At the top of your new window, type in import turtle. This statement imports the turtle library or class. 3. Because the size of the circle, pen size and location are changing with the loop, we need to create variables for these. Enter the following under your import statement 4. To give our loop a starting point we need to initialize some variables #variables horizontal = int() radius int() colors = ["red", "blue", "yellow", "green"] pen_size = int() The variable colors is a list. Although we have not covered lists yet, a list is a data type that allows us to store more than one value in it Unlike radius that will only store one number, colors will store the values, red, blue, yellow and green To access each element within the list we use and index For instance to access blue we would write. colors [1] As you can see blue is located in the second spot but referenced by 1. That is because indexes start at 0. In our code we will use a FOR loop to supply the indexes so that we can access the different colors. 5. #initializing the location and size of the circles horizontal - -200 radius - 25 pen_size = 2 cells born 600 PageStep 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