Question

In: Computer Science

No other code on this website works. Define a function drawCircle. This function should expect a...

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:

  • X = 25
  • Y = 75
  • Radius = 100

Solutions

Expert Solution

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()


Related Solutions

Define a function drawCircle. This function should expect a Turtle object, the coordinates of the circle’s...
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...
Write code to define a function named mymath. The function has three arguments in the following...
Write code to define a function named mymath. The function has three arguments in the following order: Boolean, Integer, and Integer. It returns an Integer. The function will return a value as follows: 1. If the Boolean variable is True, the function returns the sum of the two integers. 2. If the Boolean is False, then the function returns the value of the first integer - the value of the second Integer.
Modify the original code and add an additional function of your choice. The function should be...
Modify the original code and add an additional function of your choice. The function should be unique and something you created for this assignment. Support your experimentation with screen captures of executing the new code. Prepare a test table with at least 3 distinct test cases listing input and expected output for your unique function. #include <stdio.h> void printHelp () { printf ("\n"); printf ("a: a(x) = x*x\n"); printf ("b: b(x) = x*x*x\n"); printf ("c: c(x) = x^2 + 2*x...
Explain how you can secure passwords and other sensitive data on a website. Provide code snippets...
Explain how you can secure passwords and other sensitive data on a website. Provide code snippets to explain your approach. Your answer can be based on the use of PHP/MySQL or ASP.NET/SQL based solution. Explain how online advertisements will be stored and served.
Define the term: Flotation Costs. Should we expect the flotation costs for debt to be significantly...
Define the term: Flotation Costs. Should we expect the flotation costs for debt to be significantly lower than those for equity? Why or why not? Please support your answer using supporting information from the chapters in this unit and the course. Do you agree with the positions taken by your classmates? Can you provide counterpoints or insight as to why they may want to reconsider their view of expected flotation costs?
Define the term: Flotation Costs. Should we expect the flotation costs for debt to be significantly...
Define the term: Flotation Costs. Should we expect the flotation costs for debt to be significantly lower than those for equity? Why or why not? Please support your answer using supporting information from the chapters in this unit and the course. Do you agree with the positions taken by your classmates? Can you provide counterpoints or insight as to why they may want to reconsider their view of expected flotation costs?
Write python 3 code to define a function that uses three arguments, and returns a result....
Write python 3 code to define a function that uses three arguments, and returns a result. The function returns True if the first argument is more than or equal to the second argument and less than or equal to the third argument, otherwise it returns False. Write a python 3 code for function main, that does the following: creates a variable and assign it the value True. uses a while loop which runs as long as the variable of the...
Ethics in Accounting and Business Question What other loyalties should employers expect from employees? What loyalties...
Ethics in Accounting and Business Question What other loyalties should employers expect from employees? What loyalties should employees expect from the companies they work for?
Use Python to solve each problem. Answers should be written in full sentences. Define a code...
Use Python to solve each problem. Answers should be written in full sentences. Define a code that will give users the option to do one of the following. Convert an angle from radians to degrees, Convert an angle from degrees to radians, Return the sine, cosine, or tangent of a given angle (need to know if angle is given in degrees or radians).
Using Java, define a train class and write code to demonstrate its functionality The train should...
Using Java, define a train class and write code to demonstrate its functionality The train should run between Boston and New York, stopping at different, different station along the way. Provide output to indicate the train’s current status.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT