Write a fur y1) and (x test(slop test (slop test(slop test (slop Then use intercept test (int test(int test(int 4. Write a fu argument Add your 5. Now write

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
How do you do 13?
test(hypotenuse (3, 4), 5.0)
test(hypotenuse (12, 5), 13.0)
test(hypotenuse (24, 7), 25.0)
test(hypotenuse (9, 12), 15.0)
13.)Write a function slope(x1, y1, x2, y2) that returns the slope of the line through the points (x1,
y1) and (x2, y2). Be sure your implementation of slope can pass the following tests:
def slope (x1,42,x2,yzJ;
return y2 -Y1/ xz-x1
test (slope(5, 3, 4, 2), 1.0)
test(slope(1, 2, 3, 2), 0.0)
test(slope(1, 2, 3, 3), 0.5)
test(slope(2, 4, 1, 2), 2.0)
Then use a call to slope in a new function named intercept(x1, y1, x2, y2) that returns the y-
intercept of the line through the points (x1, y1) and (x2, y2)
def interceot (x 4, Y1,x?, y2);
test (intercept (1, 6, 3, 12), 3.0)
test(intercept(6, 1, 1, 6), 7.0)
test(intercept (4, 6, 12, 8), 5.0)
14. Write a function called is even(n) that takes an integer as an argument and returns True if the
argument is an even number and False if it is odd.
Add your own tests to the test suite.
15. Now write the function is odd (n) that returns True when n is odd and False otherwise. Include
unit tests for this function too.
Finally, modify it so that it uses a call to is_even to determine if its argument is an odd integer,
Transcribed Image Text:test(hypotenuse (3, 4), 5.0) test(hypotenuse (12, 5), 13.0) test(hypotenuse (24, 7), 25.0) test(hypotenuse (9, 12), 15.0) 13.)Write a function slope(x1, y1, x2, y2) that returns the slope of the line through the points (x1, y1) and (x2, y2). Be sure your implementation of slope can pass the following tests: def slope (x1,42,x2,yzJ; return y2 -Y1/ xz-x1 test (slope(5, 3, 4, 2), 1.0) test(slope(1, 2, 3, 2), 0.0) test(slope(1, 2, 3, 3), 0.5) test(slope(2, 4, 1, 2), 2.0) Then use a call to slope in a new function named intercept(x1, y1, x2, y2) that returns the y- intercept of the line through the points (x1, y1) and (x2, y2) def interceot (x 4, Y1,x?, y2); test (intercept (1, 6, 3, 12), 3.0) test(intercept(6, 1, 1, 6), 7.0) test(intercept (4, 6, 12, 8), 5.0) 14. Write a function called is even(n) that takes an integer as an argument and returns True if the argument is an even number and False if it is odd. Add your own tests to the test suite. 15. Now write the function is odd (n) that returns True when n is odd and False otherwise. Include unit tests for this function too. Finally, modify it so that it uses a call to is_even to determine if its argument is an odd integer,
Expert Solution
Step 1

In this question, we are asked to write a function for slope and intercept

Slope :  m = (y2-y1)/(x2-x1)

Y intercept : y = m*(-x1) + y1

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Fibonacci algorithm
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education