# Python: Function to check whether a number is divisible by another number

## Python Basic: Exercise-147 with Solution

Write a Python function to check whether a number is divisible by another number. Accept two integer values from the user.

**Sample Solution:**

**Python Code :**

```
# Define a function named 'multiple' that takes two arguments, 'm' and 'n'.
def multiple(m, n):
# Check if 'm' is a multiple of 'n' by using the modulo operator.
# If the remainder is 0, return True, indicating 'm' is a multiple of 'n'.
# Otherwise, return False.
return True if m % n == 0 else False
# Call the 'multiple' function with different arguments and print the results.
print(multiple(20, 5)) # Check if 20 is a multiple of 5 and print the result.
print(multiple(7, 2)) # Check if 7 is a multiple of 2 and print the result.
```

Sample Output:

True False

**Pictorial Presentation: **

**Flowchart:**

**Python Code Editor :**

**Previous:** Write a Python program to find the location of Python module sources.

**Next:** Write a Python function to find the maximum and minimum numbers from a sequence of numbers.

**What is the difficulty level of this exercise?**

Test your Programming skills with w3resource's quiz.

**Weekly Trends**- 100 Python Projects for Beginners with solution
- Mastering NumPy: 100 Exercises with solutions
- SQL Tutorial
- SQL Inner Join
- Python Exercises, Practice, Solution
- Python Interview Questions and Answers: Comprehensive Guide
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript HTML Form Validation
- Java Collection Exercises