FOR PYTHON Write functions testQ1 testQ2 and testQ3 that tes
(FOR PYTHON) Write functions testQ1(), testQ2(), and testQ3() that test your Q1, Q2, and Q3 functions on a variety of input values. For example, for some imagined function foo(n1, n2), a test function and its output might be:
Note: most good test functions should contain more than three tests!
Solution
 def Q1(a,b):
    return a+b
def testQ1():
 print(\"Q1(2,3) returns {}\".format(Q1(2,3)))
 print(\"Q1(5, -1) returns {}\".format(Q1(5, -1)))
 print(\"Q1(100, -23) returns {}\".format(Q1(100, -23)))
 print(\"Q1(200, 0) returns {}\".format(Q1(200, 0)))
def Q2(a,b):
    return a-b
def testQ2():
 print(\"Q2(2,3) returns {}\".format(Q2(2,3)))
 print(\"Q2(5, -1) returns {}\".format(Q2(5, -1)))
 print(\"Q2(100, -23) returns {}\".format(Q2(100, -23)))
 print(\"Q1(200, 0) returns {}\".format(Q2(200, 0)))
def Q3(a,b):
    return a*b
def testQ3():
 print(\"Q3(2,3) returns {}\".format(Q3(2,3)))
 print(\"Q3(5, -1) returns {}\".format(Q3(5, -1)))
 print(\"Q3(100, -23) returns {}\".format(Q3(100, -23)))
 print(\"Q1(200, 0) returns {}\".format(Q3(200, 0)))
 testQ1()
 print \"=======================================================\ \"
 testQ2()
 print \"=======================================================\ \"
 testQ3()
===================================================================================
Output:
akshay@akshay-Inspiron-3537:~/Chegg$ python testQ.py
 Q1(2,3) returns 5
 Q1(5, -1) returns 4
 Q1(100, -23) returns 77
 Q1(200, 0) returns 200
 =======================================================
Q2(2,3) returns -1
 Q2(5, -1) returns 6
 Q2(100, -23) returns 123
 Q1(200, 0) returns 200
 =======================================================
Q3(2,3) returns 6
 Q3(5, -1) returns -5
 Q3(100, -23) returns -2300
 Q1(200, 0) returns 0


