Question: Python 3 question: Implement function points() that takes as input four numbers x1, y1, x2, y2 that are the coordinates of two points (x1;y1) and

Python 3

question: Implement function points() that takes as input four numbers x1, y1, x2, y2 that are the coordinates of two points (x1;y1) and (x2; y2) in the plane. Your function should compute: a. The slope of the line going through the points, unless the line is vertical b. The distance between the two points. Your function should print the computed slope and distance in the following format. If the line is vertical, the value of the slope should be string 'infinity'. Note: Make sure you convert the slope and distance values to a string before printing them.

>>> points(0, 0, 1, 1) The slope is 1.0 and the distance is 1.41421356237

>>> points(0, 0, 0, 1) The slope is infinity and the distance is 1.0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!