Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions

Question

8. Describe how cultural spaces are formed.

Answered: 1 week ago