Ask Question
11 March, 20:21

Write a function named isDivisible that takes two parameters

1. maxInt , an integer

2. twoInts , a tuple of two integers

The function isDivisible should create and return a list of all the ints in the range from 1 to maxInt (not including maxInt ) that are divisible of both ints in twoInts .

b. Create three test cases, each consisting of a value for maxInt and a value for twoInts , for yourfunction in Problem 2a. One of these tests should return the empty list. For each test casewrite two assignment statements and a function call that pass the test arguments to yourfunction.

+2
Answers (1)
  1. 11 March, 21:59
    0
    def isdivisible ():

    maxint=input ("Enter the Max Int")

    int1=0

    int2=0

    int1=input ("Enter the first Integer")

    int2=input ("Enter the second Integer")

    tup1 = (int1, int2)

    print (tup1)

    i = 1

    for i in range (1, int (maxint) - 1):

    if int (tup1[0]) %i==0 & int (tup1[1]) %i==0:

    print (i)

    else:

    continue

    isdivisible ()

    1.2 Outputs

    First test case:

    Enter the Max Int6

    Enter the first Integer2

    Enter the second Integer8

    ('2', '8')

    1

    2

    Second test case: returning empty list

    Enter the Max Int2

    Enter the first Integer13

    Enter the second Integer27

    ('13', '27')

    Test case 3:

    Enter the Max Int4

    Enter the first Integer8

    Enter the second Integer10

    ('8', '10')

    1

    2

    Explanation:

    The program is as above, and the three test cases are also mentioned. We have created a tuple out of two input integer, and performed the output as required.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a function named isDivisible that takes two parameters 1. maxInt , an integer 2. twoInts , a tuple of two integers The function ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers