Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a Python program that draws a snowman, which appears as below. It is drawn as three circles stacked and just touching as shown, two
Write a Python program that draws a snowman, which appears as below. It is drawn as three circles stacked and just touching as shown, two filled rectangles for a hat, and two filled circles for the eyes. The mouth is a rectangle with a height of one pixel.
Enter the radius for the largest circle: 50 1) draw_circle(): It draws a circle at specified locations with a given radius and color. It has the following parameters:
a) x, the x coordinate of the point where the circle is to be placed
b) y the y coordinate at the point where the circle is to be placed
c) radius, the radius of the circle in pixels
d) color,thecolortobeusedfordrawingthecircle,and
e) fill, a Boolean, which says whether the circle is to be filled.
2) draw_rectangle():Itdrawsafilledrectangleataspecifiedlocationwithagivenwidth,height, and color. It has the following parameters:
f) x, the x coordinate of the point where the rectangle is to be placed
g) y, the y coordinate of the point where the rectangle is to be placed
h)width, the width of the rectangle in pixels
I) height, height the rectangle in pixels
j) color, the color to be used for filling the rectangle
3) draw_snowman():Itusesdraw_circle()anddraw_rectangle()andpossiblysometurtle function calls to draw the snowman. It gets the radius of the bottommost circle as its only parameter. You should place the snowman in a reasonably visible part of the window.
The relative dimensions of the different parts of the snowman are as follows. As long as you are close to these dimensions and the snowman looks close to what is shown above, you will not lose points for size-related aspects.
a) The center circle radius is 60% of that of the radius of the bottom circle.
middle circle. The height of this rectangle is equal to 80% of the radius of the top circle.
b) the top circle radius is 40% of that of the radius of the bottom circle
c) the width and height of the less wide rectangle that forms part of the hat is equal to the diameter of the top circle
d) the width and height of the less wide rectangle that forms part of the hat is equal to the diameter of the top circle
e) the two eyes are circled filled black color. The radius is 5% the radius of the bottom circle
f) the length of the mouth is 20% of the bottom circle. Draw it as a rectangle with a height of one pixel.
Step 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