Multiple in interval X36596


Statement
 

pdf   zip

Write a function @multiple_in_interval(a,b,x)@ that given three integers aa, bb, and xx, returns True if the interval [a,b][a,b] contains a number that is multiple of xx, and False otherwise.

We are guaranteed that all three numbers aa, bb, and xx will be strictly greater than zero.

Sample session

Observations

If you want to test your program locally, remember to include the following lines at the end of the file:

if __name__ == "__main__":
   import doctest
   doctest.testmod(verbose=True)
Sample session
>>> multiple_in_interval(5, 10, 2)
True
>>> multiple_in_interval(10, 5, 2)
False
>>> multiple_in_interval(10, 10, 2)
True
>>> multiple_in_interval(51, 58, 5)
True
>>> multiple_in_interval(50, 55, 7)
False
>>> multiple_in_interval(100, 180, 92)
False
>>> multiple_in_interval(5, 10, 2) and (3>2)
True
Information
Author
ProAl
Language
English
Official solutions
Python
User solutions
Python