Question: Create a function called (rtrnslope). This function will take 4 integers and return a float. each float will be between 0 and 10. You
• Create a function called (rtrnslope). This function will take 4 integers and return a float.
• each float will be between 0 and 10. You will do input validation outside of the function.
• Inside the function, the first two numbers are the x and y values of a point on a Cartesian map. Note: You can review Cartesian maps on Khan Academy, if you don't remember!
• The last two numbers are the x and y values of a second point.
• Your function should return the calculate slope of these two points.
• Call your rtrnslope function inside your challenge4.py script. Use hard-coded values to test. For example, rtrn_slope(1, 1, 3, 3) should return a slope of 1.0.
• Once your function is returning the correct slope, use input() to get these values from the user. Remember to validate the user input!. Values outside of the acceptable range should cause an error.
• Finally, put the second input() statement inside a while loop.

Sample Output Please note I omitted the input validation step from this sample, however your code should have it! Enter the starting X value: 1 Enter the next Y value: 1 Enter the new X value: 3 Enter the new Y value: 3 Slope is: 1.0 Enter the new X value: 3 Enter the new Y value: 3 Slope is: 0.0 Enter the new X value: 5 Enter the new Y value: 4 Slope is: 0.5 Enter the new X value: 0 Enter the new Y value: 1 Slope is: 0.6 Enter the new X value: 3 Enter the new Y value: 0 Slope is: -0.3333333333333333
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
