Write a function called move_to(pos) that moves the turtle to the position pos with the pen...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a function called move_to(pos) that moves the turtle to the position pos with the pen up and then puts the pen down so that it is ready to draw. pos should be a list (or tuple) with two items (x and y positions). Include the condition that if an empty position list is passed ([]), the turtle position remains unchanged. Call your function with pos= [100,100] to demonstrate that it works. Define a function called draw_square(L, pos) that starts drawing at pos with L being the length of one side of the square. Give pos a default value of 0. You should use the move_to() function you wrote for part a to position the turtle. Call your function after the definition with L=50 and without a pos argument to make sure it works as anticipated. Write another function called draw_polygon(P, pos) that takes in a list of parameters P=[N.L], and draws a polygon with N sides of L length starting at position pos. Give pos a default value of [].Call your function to demonstrate that it works as anticipated. Make a function called draw_circle(r, pos) that draws a circle with radius r starting at position pos. You can use the draw_polygon() function to actually do the drawing. To get the radius right, you just want L to be 2z/N using an N that is large enough so that you can't see the facets (but not so large that it is slow). Give pos a default value of []. Call your function to demonstrate that it works as anticipated. Make a function called draw_flower(shape, N, P, pos). This function should draw the inputted shape N times around a circle, with P being the parameters needed to run shape and pos as the position of the center of the flower. The input shape will be one of the functions you have already written! Call your function to demonstrate that it works as anticipated. An example for a flower with 25 pentagon petals is shown below. When you are successful, include a screenshot in the markdown cell below your code. You probably will want to clear your screen using t.clear(). Make a function called draw_spiral) that draws a spiral with details of your choosing. Write a function called move_to(pos) that moves the turtle to the position pos with the pen up and then puts the pen down so that it is ready to draw. pos should be a list (or tuple) with two items (x and y positions). Include the condition that if an empty position list is passed ([]), the turtle position remains unchanged. Call your function with pos= [100,100] to demonstrate that it works. Define a function called draw_square(L, pos) that starts drawing at pos with L being the length of one side of the square. Give pos a default value of 0. You should use the move_to() function you wrote for part a to position the turtle. Call your function after the definition with L=50 and without a pos argument to make sure it works as anticipated. Write another function called draw_polygon(P, pos) that takes in a list of parameters P=[N.L], and draws a polygon with N sides of L length starting at position pos. Give pos a default value of [].Call your function to demonstrate that it works as anticipated. Make a function called draw_circle(r, pos) that draws a circle with radius r starting at position pos. You can use the draw_polygon() function to actually do the drawing. To get the radius right, you just want L to be 2z/N using an N that is large enough so that you can't see the facets (but not so large that it is slow). Give pos a default value of []. Call your function to demonstrate that it works as anticipated. Make a function called draw_flower(shape, N, P, pos). This function should draw the inputted shape N times around a circle, with P being the parameters needed to run shape and pos as the position of the center of the flower. The input shape will be one of the functions you have already written! Call your function to demonstrate that it works as anticipated. An example for a flower with 25 pentagon petals is shown below. When you are successful, include a screenshot in the markdown cell below your code. You probably will want to clear your screen using t.clear(). Make a function called draw_spiral) that draws a spiral with details of your choosing.
Expert Answer:
Answer rating: 100% (QA)
A def movetopos if pos x y pos tpenup tgotoxy tpendown moveto100100 B def drawsquareL pos if pos mov... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
As part of her role, Jen is responsible for unloading some of the material that is transferred using a spool her team has put together (see the figure below). Each block of material (block A) is 20...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Select only 2. Two questions which can be used to address ethical issues impacting organizations and Human Resource Management include: What would my Supervisor say? Does this behavior or result meet...
-
Through what potential difference must electrons be accelerated so they will have? (a) The same wavelength as an x ray of wavelength 0.150 nm and (b) The same energy as the x ray in part (a)?
-
LaneScapes Incorporated Transactions Background LaneScapes Incorporated is a newly founded corporation in Oregon that provides premium ecologically conscious landscaping services in Lane County....
-
For the models shown below, determine whether it is a linear model, an intrinsically linear model, or a nonlinear model. If the model is intrinsically linear, show how it can be linearized by a...
-
A mathematical programming system named SilverScreener uses a 0-1 integer programming model to help theater managers decide which movies to show on a weekly basis in a multiple-screen theater...
-
What is an environmental scan and why is it important? How does the environmental scan impact the marketing plan? Next, read the article "Apple Signals Coronavirus's Threat to Global Business". How...
-
Windemere Limited is a Canadian-controlled private corporation founded 12 years ago by Mr. White who holds all of the shares which he purchased at that time from the company for $1,000. As of...
-
1. What is Internet of Things ? , Give three application examples in today business environment. 2. What is the difference between Virtual reality is Augmented Reality. Give one example for Virtual...
-
What is the minimum number of test cases needed to meet statement coverage criterion for the following code? int total; public int show(int val) { total = 0; if (val <0)( } val = -val; while (val >...
-
You work for an eCommerce company that sells ergonomic office products. You are tasked with creating a Power BI report from your company's transactional sales data in a table called 'ergoSales'....
-
2. Make a one-dimensional array with 15 integers. Using an enhanced for loop complete the following tasks: a. Use the following numbers: 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30) b....
-
public static double addition (int x, double y) { } double sum =x+y; return sum; 1. What is name of the method in the code fragment above? (1 Marks) 2. What is the return type of the method in the...
-
correct the errors then find the output: class A { int x; double y; void add(int a, int b) { x = a + b; } void add(double c, double d) { y = c +d; } overload() { this.x = 0; this.y = 0; } } class...
-
a) The dipole moment of HBr is 0.80D. Whatis the dipole moment of HBr in C?m? (answer= 2.67 x10^-30 c x m) b) The distance between the atomsof H?Br is 1.41. What is the distance inmeters? c) What is...
-
Identify the Critical Infrastructure Physical Protection System Plan.
-
1. What options did the employer have at its disposal to improve the performance of the sales department other than the massive terminations of its older employees? 2. Speculate as to why Gfeller and...
-
The Pacific & Arctic Railway halted operations between Skagway, Alaska, and the Yukon Territory. The union filed grievances, and a three-member arbitration panel, consisting of a union member, a...
-
William Chapman, Edwin Russ, and Antoinette Rhoads were among the members of UAW who were on strike in support of union demands during collective bargaining with their employer, E-Systems, Inc. After...
-
What are the values of the feathering parameters for the airfoils given by Examples 8.5 and 8.6? Examples 8.5 Assume an airfoil pitching about its leading edge and plunging with \(k=0.35\) as follows...
-
Obtain the lift and propulsive force coefficients of an airfoil given in Example 8.6, and compare the results with Problem 8.30. Assume the profile pitches about midchord. Example 8.6 The NACA 0012...
-
Find the heat transfer rate \(\mathrm{q}_{\mathrm{w}}\) at \(\mathrm{x}=10 \mathrm{~cm}\) and \(100 \mathrm{~cm}\) for the flat plate given in Problem 7.31. Problem 7.31 A flat plate of \(4...
Study smarter with the SolutionInn App