In this article we will create a python function which will take in three arguments, the first one is the number which will be divided by the other two. If the number is divisible by the other two numbers then this function will return true or else it will return false.

The key point here is to check whether that number will leave any remainder or not after it gets divided by two other numbers.

Below is the full solution to the above question.

def is_divide_by(number, a, b):
  if number % a == 0 and number % b == 0:
      return True
  else:
      return False

A very simple method using the python modulus operator to get the job done!

Please follow and like us:

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *