subject

Functions on Structured Data This part will be executed with: python funcs_objects tests. py
Objects
Define a class to represent a two-dimensional point. In the funcs_objects directory, create a file named objects. py. You will define a class in objects. py to represent the structure of Point objects. The class Point type will need two attributes (named x and y); as before this means that theinit function must take these two arguments (in addition to self) and initialize the attributes within self.
Define a class to represent a circle. Add this class to the objects. py file. The class Circle type will need two attributes to represent the center point (this will be an object of the Point class) and the radius.
Be sure to test yourinit functions by creating objects and verifying that the attributes have been properly initialized. You can place the test cases in the provided funcs_ objects tests. py file.
Note that testing the fields of an object that are themselves objects requires a bit more work than one might initially expect. For instance, when verifying that a circle has been properly initialized, you should not compare the center to another Point, but should instead compare each field of the center point (i. e., the center. x and center. y components) to the expected values. Comparing objects directly can be done, but doing so is beyond the scope of this lab.
Functions on Point and Circle
In the funcs_objects directory create a file named funcs_objects. py. Place your test cases in the provided funcs_objects_tests. py file.
If you wish to use any of the functions from the previous part, you will find that the simplest approach at this time is to copy your funcs. py file to this directory. To do so, from within the funcs_objects directory, type cp ../funcs/funcs. py . (the . (dot) at the end of that command is important; it signifies the current directory as the destination of the copy).
You must provide at least two test cases for each of these functions. In order to test these functions, you will first need to create an appropriate number of objects and then call the function that you wish to test. If an object is to be returned, then you will need to assign the result to a variable and test each field independently.
distance
Write a function, named distance, that takes two arguments of type Point and that returns the Euclidean distance between these two points.
circles_overla
Write a function, named circles_overlap, that takes two arguments of type circle and that returns True when the circles overlap and False otherwise (consider circles touching at the edge as non-overlapping). You must write this function using a relational operator and without using any sort of conditional.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:00
If your accelerator suddenly gets stuck what should you do
Answers: 2
question
Computers and Technology, 22.06.2019 22:40
Least square fit to polynomial write a function leastsquarefit3pol that solves a linear system of equations to find a least squares fit of a third order polynomial to an experimental data set given as two row arrays. the function leastsquarefit3pol must explicitly solve a set of linear equations and cannot use polyfit. there should be no restriction on the size of the problem that can be solved.
Answers: 1
question
Computers and Technology, 22.06.2019 23:30
What is the digital revolution and how did it change society? what are the benefits of digital media?
Answers: 1
question
Computers and Technology, 23.06.2019 18:00
Which finger presses the h key on the keyboard? index finger on the left hand pinky finger on the right hand index finger on the right hand thumb on the left hand
Answers: 1
You know the right answer?
Functions on Structured Data This part will be executed with: python funcs_objects tests. py
...
Questions
Questions on the website: 13722363