✅✅✅ Faster than 98% | Easy to understand
\nclass Solution:\n    def convertToBase7(self, num: int) -> str:\n        if num==0: return "0"\n        a=\'\'\n        if num<0:\n            num=-num\n     
```\nclass Solution:\n    def convertToBase7(self, num: int) -> str:\n        if num==0: return "0"\n        a=\'\'\n        if num<0:\n            num=-num\n            a = \'-\'\n        base7 = \'\'\n        while num>0:\n            base7+=str(num%7)\n            num = num//7\n        return a+base7[::-1]\n```
['Python3']