1

# Using python 3: Do not change the tests. Write the body of the distFromOrigin method. class...

## Question

###### Using python 3: Do not change the tests. Write the body of the distFromOrigin method. class...

using python 3:

Do not change the tests. Write the body of the distFromOrigin method.

class Point:

def __init__(self, initX, initY):
""" Create a new point at the given coordinates """
self.__x = initX
self.__y = initY

def getX(self):
""" Get its x coordinate """
return self.__x

def getY(self):
""" Get its y coordinate """
return self.__y

def __str__(self):
""" Return a string representation of self """
return "({}, {})".format(self.__x, self.__y)

def distFromOrigin(self):
""" Return the distance between self and (0,0) """
return 0

if __name__ == "__main__":
import test
a = Point(-4,3)
test.testEqual(a.distFromOrigin(), 5)

b = Point(1,1)
test.testEqual(b.distFromOrigin(), 2**0.5)

#### Similar Solved Questions

##### If an organism's diploid number is 12, what will its haploid number be?
If an organism's diploid number is 12, what will its haploid number be?...
##### How does the total energy change when a falling rock hits the ground
how does the total energy change when a falling rock hits the ground?...
##### Problem 5-24 Break-Even and Terget Profit Analysis [LOS-5, LO5-6) tWorks sells a large variety of tee...
Problem 5-24 Break-Even and Terget Profit Analysis [LOS-5, LO5-6) tWorks sells a large variety of tee shirts and sweatshirts. Steve Hooper, the owner, is thinking of expanding his sales by hiring high school students, on a commission basis, to sell sweatshirts bearing the name and mascot of the loca...
##### QUESTION 19 4 points Customer-oriented promotion gives customers a reason to come to the point of...
QUESTION 19 4 points Customer-oriented promotion gives customers a reason to come to the point of purchase and request the product. This process represents which of the following types of activities. o push promotion O pull promotion O horizontal promotion O vertical promotion...
##### If you were the U.S. President, under what circumstances would you drastically raise import tariffs for...
If you were the U.S. President, under what circumstances would you drastically raise import tariffs for a particular product or for imports from a particular country? Under what circumstances would you enact an embargo? What are some likely impacts on the U.S. industry for that product and the indus...
##### Which one of the following answers is correct? If this null hypothesis H0: B1 = B2...
Which one of the following answers is correct? If this null hypothesis H0: B1 = B2 = B3 = 0 is rejected, the interpretation is: a. There is no linear relationship between Y and any of the 3 independent variables b. There is a regression relationship between Y and at least one of the 3 independent va...
##### Sample Hypotheses 1. If the rate of skin cancer occurrence is related to exposure to ultraviolet...
Sample Hypotheses 1. If the rate of skin cancer occurrence is related to exposure to ultraviolet light, then people with a high exposure to UV light will have a higher frequency of skin cancer. Independent variable - Dependent variable - Confounding variable - 2. If the color of the leaves on a tree...
##### What if the patient is hypervolemic or hypovolemic? If so, what data supports this? What effect...
What if the patient is hypervolemic or hypovolemic? If so, what data supports this? What effect do you see on the patient’s vitals from them being hyper or hypovolemic? What illnesses can put a patient at risk for a fluid and electrolyte disturbance? How so? If the patient has Mg, K, or Ca val...
##### PRINCIPLES MANAGEMENT Emirates islamic bank (EIB) focused to the next level of success, expanding the reach...
PRINCIPLES MANAGEMENT Emirates islamic bank (EIB) focused to the next level of success, expanding the reach of the organization on a local and regional level. EIB are driven to building our organization on the two pillars of Personal and Commercial Banking, which will serve as the engine for our fut...
##### You are interested in thymol in mouthwash. The manufacturer lists the active ingredients as thymol (0.064%),...
You are interested in thymol in mouthwash. The manufacturer lists the active ingredients as thymol (0.064%), menthol (0.042%), eucalyptol (0.092%) and methyl salicylate. The inactive ingredients include caramel, water and alcohol (21.6%) in addition to sodium benzoate, color, poloxamer 407 and benzo...
##### Explain Both and Answer Thank You The eyeless trait is recessive in Drosophila. One of the...
Explain Both and Answer Thank You The eyeless trait is recessive in Drosophila. One of the offspring of a cross between heterozygote (Ee) parents has eyes. How would you determine whether this fly is homozygous (EE) or heterozygous (Ee)? Cross it with a fly that has eyes but an unknown genotype ...
##### The speed of particle with 9e C charge is 7.6x104 m/s, and the magnitude of the...
The speed of particle with 9e C charge is 7.6x104 m/s, and the magnitude of the magnetic force is 15.4 x10-15 N. What is the magnitude of the magnetic field if the particle is traveling 16º to the field? (Recall e is the magnitude of the charge of an electron.)...
##### 6. -14 points SerCP11 6.2.P.028. My Notes + Ask Your Teacher Two objects of masses m...
6. -14 points SerCP11 6.2.P.028. My Notes + Ask Your Teacher Two objects of masses m = 0.50 kg and m2 = 0.90 kg are placed on a horizontal frictionless surface and a compressed spring of force constant k = 300 N/m is placed between them as in figure (a). Neglect the mass of the spring. The spring is...
##### Show that the matrix is not diagonalizable. 1-42 13 0 02 STEP 1: Use the fact...
Show that the matrix is not diagonalizable. 1-42 13 0 02 STEP 1: Use the fact that the matrix is triangular to write down the eigenvalues. (Enter your answers from smallest to largest.) (11.22) = STEP 2: Find the eigenvectors Xi and X2 corresponding to 1, and 12, respectively. X1 = X2 - STEP 3: Sinc...