Write a function to calculate the distance between two points Distance( x1, y1,x2.2) For example Distance(0.0,3.0, 4.0.0.0) should return 5.0 Use the function in main to loop through reading in pairs of points until the all zeros are entered printing distance with two decimal precision for each pair of points.
For example with input
32 32 54 12
52 56 8 30
44 94 4439 6
5 19 51 91 7.5
89 34 0000
Your output would be:__________.
a. 29.73
b. 51.11
c. 55.00
d. 73.35
e. 92.66

Answers

Answer 1

Answer:

The function in Python3  is as follows

def Distance(x1, y1, x2, y2):

   dist = ((x1 - x2)**2 +(y1 - y2)**2)**0.5

   return dist

   

Explanation:

This defines the function

def Distance(x1, y1, x2, y2):

This calculates distance

   dist = ((x1 - x2)**2 +(y1 - y2)**2)**0.5

This returns the calculated distance to the main method

   return dist

The results of the inputs is:

[tex]32, 32, 54, 12 \to 29.73[/tex]

[tex]52,56,8,30 \to 51.11[/tex]

[tex]44,94,44,39\to 55.00[/tex]

[tex]19,51,91,7.5 \to 84.12[/tex]

[tex]89,34,00,00 \to 95.27[/tex]


Related Questions

NEED HELP IMMEDIATELY!!
What is the difference between a worm and a typical virus?
A) Worms are a type of spyware; viruses are a type of malware.
B) Worms are impossible to remove; viruses can be tracked and removed.
C) Worms are stronger than viruses; viruses are stronger than spam.
D) Worms travel independently of human action; viruses require human actions.

Answers

Answer:

Option C

Explanation:

Option A is incorrect as Worm is a form of malware

Option B is incorrect because antivirus can remove all forms of malware

Option C is correct because a worm is more problematic as compared to the virus. Also, viruses are weaker than worm because they need a host file to run but a worm can work independently.

Option D is also incorrect because both are able to self replicate.

Other Questions
- 13.4h + 4.2hIts the last one pls help T or F 7. Trp Operon - which determine the formation and arrangement of body parts inmulticellular organisms, control gene expression by regulation of - DNA translation At the amusement park, Janine bought a bottle of water for $2. She also bought game tickets for $0.50 each. Janine spent a total of $15.Which of the following equations can be used to find the number of game tickets, g. Janine bought?O 0.509 + 2 = 15O2g +0.50 = 15O 0.50g - 2 = 15O 2g -0.50 = 15 How do you find zeros of a quadratic function? If there are 3000 calories of energy available at the zooplankton, how much energy will there be at the shark? For Yuri On Ice Lovers Which statement best describes Earths outer layer underneath the surface in the image? An estimate of a person's ability to pay off debts based on his or her historyof borrowing and making payments on time is called what?A. CollateralB. CapacityC. CharacterD. Charisma Lets say two items which are balls, are very identical and were dropped at the same times and same height, fell at different times. The pink ball fell first while the blue one fell last. What could have caused the pink ball to fall first? Please anwser these (give explanation) this is due today! Please and thank you! PLEASE HELP I'LL MARK BRAINLIEST IF ITS RIGHTWhat was the most common act of terrorism in the 1800s?A. Assassinations of political leadersB. Bombings of banks and financial institutionsC. Attacks against civiliansD. Acts of sabotage against military equipment Hi again i need help with these to i putted the area but the teacher said it was wrong If the interest rate rises, what will happen to overall employment levels in sectors affected by those interest rates?a.employment levels will increase b.employment levels will not be affectedc.employment levels will decrease What is the area to this?? pls help me tysmmmm!!! An architect built a scale model of a new house using a scale in which 1.5 inches represents 3 feet. The height of the house is 21 feet. What is the height of the scale model in inches? A serving size is defined as which of the following? Match these items. 1. effect observed when light from an object in cool air passes through warm air 2. line perpendicular to a surface 3. splitting of light into its component colors angle of incidence 4. alignment of light into a single vibrational direction 5. larger angle as light passes from air to water 6. cause of the sky's color 7. bouncing of light rays reflection 8. bending of light between media 9. ratio of speeds of light 10. inability of light to escape a low-velocity medium due to a large angle of approach refractiona. scatteringb.dispersionc.angle of incidenced.index of refractione.miragef.reflectiong.normalh.total inertial reflectioni.polarizationj.refraction write an expression that simplifies to x to the power of -4 This is journalism please help 50 points!Take a story from your local newspaper and write a blog post about it.You can retell the news story, add information, and so on. Don't be afraidto add your opinion to the story. Your blog post should be at least threeparagraphs in length