In: Computer Science
Implement the following function in the PyDev module functions.py and test it from a PyDev module named :
def is_divisible(n, i, j):
    """
    -------------------------------------------------------
    Determines if n is evenly divisible by both i and j.
    Use: result = is_divisible(n, i, j)
    -------------------------------------------------------
    Parameters:
        n - the number to check for divisibility (int)
        i - one of the values to divide n by (int)
        j - another value to divide n by (int)
    Returns:
        result - True if n is evenly divisible by both
            i and j, False otherwise (boolean)
    ------------------------------------------------------
    """
Sample testing:
Enter number to check for divisibility: 15 Enter first value to divide by: 3 Enter second value to divide by: 5 15 is evenly divisible by 3 and 5.
Enter number to check for divisibility: 16 Enter first value to divide by: 4 Enter second value to divide by: 3 16 is not evenly divisible by 4 and 3.
functions.py
CODE: Python Programming Language
functions.py
# is_divisible function
def is_divisible(n, i, j):
    if n % i == 0 and n % j == 0:
        return True
    else:
        return False
t06.py
from functions import is_divisible
# Taking 3 integers from the user
n = int(input("Enter number to check for divisibility: "))
i = int(input("Enter first value to divide by: "))
j = int(input("Enter second value to divide by: "))
result = is_divisible(n, i, j) # Calling is_divisible
function
if(result == True):
    print("\n{} is evenly divisible by {} and
{}.".format(n, i, j))
else:
    print("\n{} is not evenly divisible by {} and
{}.".format(n, i, j))
SCREENSHOT OF THE CODE:
functions.py

t06.py

OUTPUT:


=====================================================================
Thank you. Please ask me if you have any doubt.