Simple Python, learned about builtin divmod()
Didn\'t know about the divmod() function until this problem. It\'s an alternative way to iterate through the digits of an integer. By dividing by 10, we iterate
Didn\'t know about the divmod() function until this problem. It\'s an alternative way to iterate through the digits of an integer. By dividing by 10, we iterate backwards through the integer. \n```\nclass Solution:\n    def subtractProductAndSum(self, n: int) -> int:\n        my_prod = 1\n        my_sum = 0\n        \n        while n:\n            n, remainder = divmod(n, 10)\n            my_prod *= remainder            \n            my_sum += remainder\n            \n        return my_prod - my_sum\n```
[]