In: Computer Science
No other code on this website works.
Define a function drawCircle. This function should expect a Turtle
object, the coordinates of the circle’s center point, and the
circle’s radius as arguments. The function should draw the
specified circle. The algorithm should draw the circle’s
circumference by turning 3 degrees and moving a given distance 120
times. Calculate the distance moved with the formula 2.0 × π ×
radius ÷ 120.0.
Define a function main that will draw a circle with the following parameters when the program is run:
Thanks for the question. Below is the code you will be needing Let me know if you have any doubts or if you need anything to change. Thank You ! =========================================================================== import turtle def drawCircle(t, x, y, radius): t.penup() t.goto(x, y) t.right(90) t.forward(radius) t.left(90) t.pendown() for _ in range(120): t.left(3) t.forward(2.0 * 3.14159265 * radius / 120) t.penup() t.goto(x, y) def main(): t = turtle.Turtle() canvas = turtle.Screen() drawCircle(t, 25, 75, 100) canvas.exitonclick() main()