Python - Class Methods and Static Methods
Consider this code:
How would you modify this code to also allow calling
class Calculator:
@staticmethod
def multiply(x, y):
return x * y
result = Calculator.multiply(5, 6)
print(result)How would you modify this code to also allow calling
multiply from an instance without changing the method definition?