subject

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 pen color should be changed to yellow before drawing a circle and the width of the pen to 5 pixels. 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*n*radius/120.0.
Fill in the circle with blue color. After drawing the circle, hide the turtle.
import turtle
import math
def drawCircle(centerpoint, radius):
degree = 3
count = 0
centerpoint = (2.0 * math. pi * radius / 120)
t. home()
t. setheading(degree)
while count <= 120:
t. down()
t. forward(2.0 * math. pi * radius / 120)
t. up()
degree += 3
t. setheading(degree)
count += 1
drawCircle(centerpoint, radius)

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:30
Consider the following statements: #include #include class temporary { private: string description; double first; double second; public: temporary(string = "", double = 0.0, double = 0.0); void set(string, double, double); double manipulate(); void get(string& , double& , double& ); void setdescription(string); void setfirst(double); void setsecond(double); }; write the definition of the member function set() so that the instance variables are set according to the parameters. write the definition of the constructor so that it initializes the instance variables using the function set() write the definition of the member function manipulate() that returns a decimal number (double) as follows: if the value of description is "rectangle", it returns first * second if the value of description is "circle" it returns the area of a circle with radius first if the value of description is "cylinder" it returns the volume of a cylinder with radius first and height second. hint: the volume of a cylinder is simply the area of the circle at the base times the height. if the value of description is "sphere" it returns the volume of the sphere with radius first. otherwise it returns -1.0;
Answers: 1
question
Computers and Technology, 22.06.2019 19:20
Consider the following code snippet: #ifndef cashregister_h#define cashregister_hconst double max_balance = 6000000.0; class cashregister{public: cashregister(); cashregister(double new_balance); void set_balance(double new_balance); double get_balance() const; private: double balance[12]; }; double get_monthly_balance(cashregister bk, int month); #endifwhich of the following is correct? a)the header file is correct as given.b)the definition of max_balance should be removed since header files should not contain constants.c)the definition of cashregister should be removed since header files should not contain class definitions.d)the body of the get_monthly_balance function should be added to the header file.
Answers: 1
question
Computers and Technology, 23.06.2019 23:30
Perform an online search about the booting process of a computer and list all the steps
Answers: 2
question
Computers and Technology, 24.06.2019 08:30
Formatting rows and columns is similar to cell formatting. in an openoffice calc spreadsheet, you can format data entered into rows and columns with the of the rows and columns options. you can insert rows and columns into, or delete rows and columns from, a spreadsheet. use the insert or delete rows and columns option on the insert tab. alternatively, select the row or column where you want new rows or columns to appear, right-click, and select insert only row or only column options. you can hide or show rows and columns in a spreadsheet. use the hide or show option on the format tab. for example, to hide a row, first select the row, then choose the insert tab, then select the row option, and then select hide. alternatively, you can select the row or columns, right-click, and select the hide or show option. you can adjust the height of rows and width of columns. select row and then select the height option on the format tab. similarly, select column, then select the width option on the format tab. alternatively, you can hold the mouse on the row and column divider, and drag the double arrow to the position. you can also use the autofit option on the table tab to resize rows and columns.
Answers: 1
You know the right answer?
Define a function drawCircle.
This function should expect a Turtle object, the coordinates of...
Questions
Questions on the website: 13722359