Question
Python 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;
Python 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started