<filename>src/Sixth Chapter/Exercise12.py
# Write a function is_factor(f, n) that passes the tests below.

import sys


def is_factor(f, n):
    return n % f == 0


def test(did_pass):
    """  Print the result of a test.  """
    linenum = sys._getframe(1).f_lineno  # Get the caller's line number.
    if did_pass:
        msg = "Test at line {0} ok.".format(linenum)
    else:
        msg = ("Test at line {0} FAILED.".format(linenum))
    print(msg)


def test_suite():
    """ Run the suite of tests for code in this module (this file).
    """
    test(is_factor(3, 12))
    test(not is_factor(5, 12))
    test(is_factor(7, 14))
    test(not is_factor(7, 15))
    test(is_factor(1, 15))
    test(is_factor(15, 15))
    test(not is_factor(25, 15))


test_suite()  # Here is the call to run the tests

<filename>src/Sixth Chapter/Exercise12.py
# Write a function is_factor(f, n) that passes the tests below.

import sys


def is_factor(f, n):
    return n % f == 0


def test(did_pass):
    """  Print the result of a test.  """
    linenum = sys._getframe(1).f_lineno  # Get the caller's line number.
    if did_pass:
        msg = "Test at line {0} ok.".format(linenum)
    else:
        msg = ("Test at line {0} FAILED.".format(linenum))
    print(msg)


def test_suite():
    """ Run the suite of tests for code in this module (this file).
    """
    test(is_factor(3, 12))
    test(not is_factor(5, 12))
    test(is_factor(7, 14))
    test(not is_factor(7, 15))
    test(is_factor(1, 15))
    test(is_factor(15, 15))
    test(not is_factor(25, 15))


test_suite()  # Here is the call to run the tests

# Write a function is_factor(f, n) that passes the tests below. Print the result of a test. # Get the caller's line number. Run the suite of tests for code in this module (this file). # Here is the call to run the tests