Question 10
Back to Exercise
What is the output of the following Python program?
class MathUtil:
@staticmethod
def is_even(n):
return n % 2 == 0
m = MathUtil()
print(MathUtil.is_even(4), m.is_even(7))
- A TypeError
- B False True
- C True False Correct
- D True True
Correct Answer: Option C
A static method can be called through the class or an instance; no self is passed either way.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!