Question

In: Computer Science

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 run:

  • X = 50
  • Y = 75
  • Radius = 100

Solutions

Expert Solution

def drawCircle (turtle, centerpoint, radius):

circumference = 2 * 3.14 * (radius/120)

print "The circumference moved is", circumference

turtle.up()

(x,y) = centerpoint[-1]

turtle.turn(3)

turtle.move(120)

turtle.down()

from turtlegraphics import Turtle

turtle=Turtle()

drawCircle(turtle, [(20,20)], 20)


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...
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 coordinates of an object moving in the XY plane vary with time according to the...
The coordinates of an object moving in the XY plane vary with time according to the equations  x = −7.43 sin ωt and y = 4.00 − 7.43 cos ωt, where ω is a constant, x and y are in meters, and t is in seconds. (a) Determine the components of the velocity of the object at t = 0. (Use the following as necessary: ω.) (b)  Determine the components of the acceleration of the object at t = 0. (Use the...
The coordinates of an object moving in the xy plane vary with time according to the...
The coordinates of an object moving in the xy plane vary with time according to the equations x = −5.08 sin ωt and y = 4.00 − 5.08 cos ωt, where ω is a constant, x and y are in meters, and t is in seconds. (a) Determine the components of velocity of the object at t = 0. (Use the following as necessary: ω.) v with arrow = m/s (b) Determine the components of the acceleration of the object...
You should assume that there will be an object file named “foreignsub.o” which implements a function...
You should assume that there will be an object file named “foreignsub.o” which implements a function whose prototype is given in the header file “foreignsub.h”. The header file “foreignsub.h” consists of the following line. int sub(int n, int *A, int *B, int *C); However, you do not know what this function does exactly. For your testing purpose, you may produce such a function, e.g., returning the maximum value among the 3n integers in the three arrays. You are also given...
Define and test a function myRange. This function should behave like Python’s standard range function, with...
Define and test a function myRange. This function should behave like Python’s standard range function, with the required and optional arguments, but it should return a list. Do not use the range function in your implementation! Study Python’s help on the range to determine the names, positions, and what to do with your function’s parameters. Use a default value of None for the two optional parameters. If these parameters both equal None, then the only provided argument should be considered...
Create a class named GameCharacter to define an object as follows: The class should contain class...
Create a class named GameCharacter to define an object as follows: The class should contain class variables for charName (a string to store the character's name), charType (a string to store the character's type), charHealth (an int to store the character's health rating), and charScore (an int to store the character's current score). Provide a constructor with parameters for the name, type, health and score and include code to assign the received values to the four class variables. Provide a...
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?
Python question Define a function called max_value_length(tree) that takes a Binary Tree object as a parameter...
Python question Define a function called max_value_length(tree) that takes a Binary Tree object as a parameter and returns an integer that contains the longest character length of all the values in that tree. Use recursion. For example, the character length of value 123 is 3, because there are three digits. The character length of value “Ruru” is 4, because it has four characters. Further, the max_value_length() function would return 4 if the only node values in the tree were 123...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT