Question
Please use Python as a programming language for this exercise and make the code as simple as possible. Exercise 2.2 Writing Simple Methods In this
Please use Python as a programming language for this exercise and make the code as simple as possible.
Exercise 2.2 Writing Simple Methods
In this problem youll be asked to write two simple methods (method is an interchangeable term for function). Be sure to test your functions well, including at least 3 test cases for each method.
1.Write a method is_divisible that takes t wo integers ,m and n. The method returns True if m is divisible by n, and returns False otherwise. Test cases for this function are included for you; look at the conditions that they test and try to make sure your future test cases are comprehensive.
2.Imagine that Python doesnt have the!= operator built in. Write a method not equal that takes two parameters and gives the same result as the!= operator. Obviously, you cannot use!= within y our function! Test if y our code works by thinking of examples and making sure the output is the same for your new method as != gives you.
For Reference
# Define is_divisible function here
##### YOUR CODE HERE ######
Test cases for is_divisible
## Provided for you... uncomment when you're done defining your function
#print is_divisible(10, 5) # This should return True
#print is_divisible(18, 7) # This should return False
#print is_divisible(42, 0) # What should this return?
# Define not_equal function here
##### YOUR CODE HERE ######
Test cases for not_equal
##### YOUR CODE HERE #####
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started