Question: Write a Python function crosses(), to determine whether the line formed between 2 points (1, 1) and (2, 2 ) crosses the x- and/or y-axis.
Write a Python function crosses(), to determine whether the line formed between 2 points (1, 1) and (2, 2 ) crosses the x- and/or y-axis. The function prompts for the 4 values - 1, 1, 2 and 2. It outputs one of the following messages
Taking n to be any number, note that user may enter the x and y values for one point as
x = 0, y = 0, you can conclude that the x and y axis are crossed.
x = 0, y = n, you can conclude that the y axis is crossed but you must check the other point as well.
x = n, y = 0, you can conclude that the x axis is crossed but you must check the other point as well
Note that a line that crosses the origin is considered to cross both both x and y axes. An example run of the function is shown below:
Enter x-coordinate of first point: 1 Enter y-coordinate of first point: 4 Enter x-coordinate of second point: -1 Enter y-coordinate of second point: 3 Line crosses y axis only End Program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
