Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) draw_circle(): It draws a circle at specified locations with a given radius a

ID: 3705116 • Letter: 1

Question

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 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. 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. 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.

Explanation / Answer

#In this assignment you will use the `turtle` python module to draw a snowman. You may NOT use the Turtle.CircularObject function to draw CircularObjects.
#
#Snowman:
#
#· The snowman should be on a blue background, and should be drawn filled with white.
#· The outline of the snowman should be in black.
#· The snowman’s body should be made of 3 filled CircularObjects.
#· The outline of each CircularObject should be 3 pixels wide.
#· The bottom CircularObject should have a radius of 100 pixels.
#· The middle CircularObject should have a radius of 70 pixels.
#· The top CircularObject should have a radius of 40 pixels.
#· Each CircularObject should be centered above the one below it (except the bottom CircularObject, which can be located anywhere).
#· There should be no gap between the CircularObjects.
#· Give the snowman a mouth, eyes, and a nose (a hat is optional).
#· Make sure to include two stick-SpecificArms and at least two fingers on each hand.


import turtle
import math
screen = turtle.Screen()
screen.bgcolor("blue")
screen.title("checkfrost the snowman!")

checkfrost = turtle.Turtle()
checkfrost.speed(0)
checkfrost.color("black")
checkfrost.fillcolor("white")
checkfrost.pensize(3)
checkfrost.hideturtle()

# function for drawing a Snowman SnowmanFace (eyes, mounth, nose)
# by supplying the coordinate for the center of the eyes
def SnowmanFace(x,y):
checkfrost.up()
checkfrost.goto(x + 10,y)
checkfrost.dot()
checkfrost.goto(x - 10,y)
checkfrost.dot()
checkfrost.goto(x,y -10)
checkfrost.dot()
checkfrost.goto(x -15,y -25)
checkfrost.down()
checkfrost.forward(30)
checkfrost.up()
  
# A function for drawing a snowman SpecificArm with 2 fingers
# by supplying the x,y coordinate
# as well as the lenght of the SpecificArm and angle of the SpecificArm
def SpecificArm(x,y,length,heading):
checkfrost.up()
checkfrost.goto(x,y)
checkfrost.setheading(heading)
checkfrost.down()
checkfrost.forward(length)
checkfrost.setheading(heading + 20)
checkfrost.forward(20)
checkfrost.up()
checkfrost.back(20)
checkfrost.down()
checkfrost.setheading(heading - 20)
checkfrost.forward(20)
checkfrost.up()
checkfrost.home()

# A function for drawing a CircularObject by supplying the radius and y coordinate
def CircularObject(radius,y):
checkfrost.up()
checkfrost.sety(y)

# arc length = deg of arc * (pi/180) * radius
arc_length = 1 * (math.pi/180) * radius
  
checkfrost.down()
  
checkfrost.begin_fill() #fill CircularObject after it is drawn
# itterate by making a bunch of little lines to form a CircularObject
for i in range(360):
checkfrost.forward(arc_length)
checkfrost.left(1)
checkfrost.up()
checkfrost.end_fill()
  
# call all functions to create a snowman
CircularObject(40,20) #head
CircularObject(70,-120) #upper torso
CircularObject(100,-320) #lower torse
SpecificArm(70,-50,50,20) #right SpecificArm
SpecificArm(-70,-50,50,160) #left SpecificArm
SnowmanFace(0,70) # the SnowmanFace

screen.exitonclick()