Question: 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.
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.
 Write a Python program that draws a snowman, which appears as

Enter the radius for the largest circle: 50

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!