16 Run the program to compare the results to your prediction. main.py 1 2 3 4...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
16 Run the program to compare the results to your prediction. <> main.py 1 2 3 4 painter = trtl.Turtle() 5 painter.penup() 6 painter.goto(-200, 0) painter.pendown() 7 8 9 10 11 12 13 14 15 - 16 17 18 19 20 21- 22 23 24 # a114_nested_loops_4.py import turtle as trtl 25 26 x = -200 y = 0 move_x = 1 move_y = 1 while (x < 0): while (y < 100): x = x + move_x y = y + move_y painter.goto(x,y) move_y = -1 while (y > 0): X = x + move_x y = y + move_y painter.goto(x,y) move_y = 1 27 28 wn trtl. Screen() 29 wn.mainloop() = ++ B Remix ✪ Run 17 18 19 Modify the condition in the outer loop so the turtle drawing has two "peaks" as shown, instead of one. No other change to the code needs to be made. + Hint Write another nested loop after the first one so that the turtle draws an additional pattern that is the opposite of the original pattern as shown. + Hint Figure 2. Desired Output Figure 3. Desired Output Finally, place both nested loops in one outer infinite loop so that your turtle draws forever. To make a while loop iterate forever, use a Boolean value of True as its condition. Hide 16 Run the program to compare the results to your prediction. <> main.py 1 2 3 4 painter = trtl.Turtle() 5 painter.penup() 6 painter.goto(-200, 0) painter.pendown() 7 8 9 10 11 12 13 14 15 - 16 17 18 19 20 21- 22 23 24 # a114_nested_loops_4.py import turtle as trtl 25 26 x = -200 y = 0 move_x = 1 move_y = 1 while (x < 0): while (y < 100): x = x + move_x y = y + move_y painter.goto(x,y) move_y = -1 while (y > 0): X = x + move_x y = y + move_y painter.goto(x,y) move_y = 1 27 28 wn trtl. Screen() 29 wn.mainloop() = ++ B Remix ✪ Run 17 18 19 Modify the condition in the outer loop so the turtle drawing has two "peaks" as shown, instead of one. No other change to the code needs to be made. + Hint Write another nested loop after the first one so that the turtle draws an additional pattern that is the opposite of the original pattern as shown. + Hint Figure 2. Desired Output Figure 3. Desired Output Finally, place both nested loops in one outer infinite loop so that your turtle draws forever. To make a while loop iterate forever, use a Boolean value of True as its condition. Hide
Expert Answer:
Answer rating: 100% (QA)
The Python script provided uses the Turtle module to draw on a canvas Based on the questions and the provided screenshots it appears that youre being ... View the full answer
Related Book For
Operations management processes and supply chain
ISBN: 978-0136065760
9th edition
Authors: Lee J Krajewski, Larry P Ritzman, Manoj K Malhotra
Posted Date:
Students also viewed these programming questions
-
You work for boise cascade Corporation. Each month, a 15% federal income tax and a 5.06% provincial income tax are withheld from your paycheque. Your financial Advisor suggests that you increase the...
-
If the focal length of a lens is 3 centimeters and the image distance is 5 centimeters from the lens, what is the distance from the object to the lens?
-
Speeding up and slowing down A 1400kg car, starting from rest, accelerates to a speed of 30mph in 10 seconds. a) What is the force on the car (assumed constant) over this period of time? b) Where...
-
Data set: Daily saturated fat intakes (in grams) of 20 people Construct a cumulative frequency distribution and an ogive for the data set using six classes. Then describe the location of the greatest...
-
The financial statements of Shoppers Drug Mart are presented in Appendix A at the end of this book. Instructions (a) Using the statement of earnings, answer the following questions: 1. What amount...
-
Airbnb, Inc., maintains a website that lists, advertises, and takes fees or commissions for property rentals posted on the site. To offer or book accommodations on the site, a party must register and...
-
The F statistic is the quotient of the sample ____________ . In Exercises 5 and 6, fill in each blank with the appropriate word or phrase.
-
1. What is the underlying issue behind endpoint security, and why is it becoming even more difficult for companies to address it? Define the problem in your own words using examples from the case. 2....
-
Customer service: The Role of Gender in Nonverbal Communication Using this link: https://freemanmeansbusiness.com/blog/2018/9/13/gender-differences-in-communication-styles Find: Brain Differences...
-
Table contains information about an environmental cleanup project. Shorten the project three weeks by finding the minimum cost schedule. Assume that project indirect costs and penalty costs are...
-
Directions: Complete all answers on separate paper. Use pencil for all problems. Show the formula first and your calculations. You can check your answer with the financial calculator, but do not just...
-
What happens when you change the data in a worksheet associated with a chart?
-
Find the solutions of the equation a cosh x b sinh x = c, assuming that a, b, and c are constants. [Hint: The result should have the form x = f(a,b,c), where f(a, b, c) is a specific function.] =
-
Activity - based costing ( ABC ) is a costing method that allocates costs to specific activities, rather than departments or products. Discuss the concept of activity - based costing and its...
-
Self-leadership is an indispensable skill for today's healthcare leaders. A leader's ability to effectively govern their emotions, communication, and motivation provides insight into their capacity...
-
What is the overall bus width for a system that uses triple channel memory? give reason also
-
When an electromagnetic wave enters a new medium and gets split into two, do the properties of the wave change? What happens to the wavelength when being reflected and absorbed by the new medium?...
-
Open Text Corporation provides a suite of business information software products. Exhibit 10-9 contains Note 10 from the companys 2013 annual report detailing long-term debt. Required: a. Open Text...
-
1. What are major issues facing Tom and Mason Miller? 2. What are the competitive priorities for custom Molds processes and the changing nature of the industry? 3. What alternatives might the Millers...
-
Wild West, Inc. is a regional telephone company that inherited nearly 100,000 employees and 50,000 retirees from AT&T. Wild West has a new mission: to diversify. It calls for a 10-year effort to...
-
You are the project manager of the software installation project in Table. You like to find the minimum cost schedule for your project. There is a $1,000 per week penalty for each week the project is...
-
Estimate the fundamental frequency for the tapered beam of Figure 8.17 where \[ m(x)=m(1-x / L) \] and \[ E A(x)=E A(1-x / L) \] Compare your result to the exact value of \(\omega_{1}=\) \(2.40...
-
Derive the differential equation of motion for a nonuniform plate with varying thickness. Assume that the material properties such as Young's modulus and Poisson's ratio remain constant.
-
For the tapered beam sketched in Figure 8.17 undergoing transverse vibration, estimate the first two natural frequencies using the Rayleigh-Ritz procedure. Assume a trial function of the form...
Study smarter with the SolutionInn App