Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

There are several blanks in this python program. Plz fit the answers correctly to the blank. M The following program uses turtle graphics to draw

There are several blanks in this python program. Plz fit the answers correctly to the blank.

image text in transcribed

image text in transcribed

M The following program uses turtle graphics to draw a simple landscape scene with three mountains of different heights and a sun. import turtle wn = turtle.Screen() t = turtle.Turtle t. forward(100) t.left(60) t. forward(80) t.right (120) t. forward(80) t.left(60) t. left(60) t. forward(120) t.right(120) t. forward(120) t. left(60) t. left(60) t. forward(60) t.right(120) t. forward(60) t. left(60) t. forward(50) t.penup() t.goto(320, 140) t. pendown() t.circle(30) wn.exitonclick() While logically correct, this program is an example of "spaghetti code" that should be divided into several smaller functions for modularity and ease of testing. Drag and drop the following lines of code to create a *modular* version of this program that draws the same landscape scene. def draw_mountain(t, side_height, angle): t.forward(side_height) t.left(angle) def draw_sun(t, x, y, radius): draw_mountain(t, 80, 60) t.forward(50) t.left(angle) t.goto(x, y) draw_sun(t, 320, 140, 30) | draw_mountain(t, 120, 60) t.circle(radius) draw_mountain(t, 60, 60) t.pendown() t.right(angle * 2) t = turtle.Turtle() t.penup) t.forward(100) t.forward(side_height) wn = turtle.Screen() wn.exitonclick() main()

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

Recommended Textbook for

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago