Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLE HELP ME BY PYTHON PLE HELP ME BY PYTHON Part 2: Distances in Two Dimensions Consider two points with coordinates (x1, y1) and (x2.

PLE HELP ME BY PYTHON

image text in transcribed

PLE HELP ME BY PYTHON

Part 2: Distances in Two Dimensions Consider two points with coordinates (x1, y1) and (x2. y2) as shown here: (x,y) There are two ways to measure the distance: the straight line distance (shown in the solid line), which is calculated using the Pythagorean formula: V(x1-x)+(y; - y.) Another way to calculate the distance between two points is the city block distance. That's the distance you would have to go if you were walking along a rectangular grid of city blocks (shown by the dotted lines in the diagram). It is calculated using this formula: |x, - x + y - y For this part of the assignment, write a program named Lastrame_firstname_planar.py that has two functions: distance() takes four parameters that describe the points (X1.71) and (x2, y2) and returns the Pythagorean distance between them. block_distance() takes four parameters that describe the points (x, y1) and (x, y2) and returns the city block distance between them. Your program will then ask the user for the x and y coordinates of two points, calculate the Pythagorean and city block distances, and output them, properly labeled, to two decimal places

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Climate And Environmental Database Systems

Authors: Michael Lautenschlager ,Manfred Reinke

1st Edition

1461368332, 978-1461368335

More Books

Students also viewed these Databases questions