about | help | code help+videos | done | prefs |
Given two distinct ordered pairs, return whether the slope of the line that passes through them is positive, negative, undefined or zero. To avoid generating an error, structure your code to ensure that you do not divide by zero when computing slope (hint: test for undefined slope first, and calculate slope only if the test fails). The inputs, redPoint and whitePoint, are lists. Each list contains two elements, the first representing the x coordinate, and the second representing the y coordinate of a point. describeSlope([-3.0, 7.0], [9.0, 3.0]) → 'negative' describeSlope([4.0, -5.0], [4.0, 8.0]) → 'undefined' describeSlope([4.0, -5.0], [-3.0, -5.0]) → 'zero' ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 175 Post-solution available
Copyright Nick Parlante 2017 - privacy