✔ Python3 || easy to understand code || faster than 100% + one liner
\nclass Solution:\n    def subtractProductAndSum(self, n: int) -> int:\n        a,b=1,0\n        for i in list(str(n)):\n            a*=int(i)\n            b+=i
```\nclass Solution:\n    def subtractProductAndSum(self, n: int) -> int:\n        a,b=1,0\n        for i in list(str(n)):\n            a*=int(i)\n            b+=int(i)\n        return (a-b)\n```\nAnother more optimized code | One line code\n```\nclass Solution:\n    def subtractProductAndSum(self, n: int) -> int:\n\t\treturn prod(list(map(int,str(n))))-sum(list(map(int,str(n))))\n```
['Python', 'Python3']