Beats 99% - Easy Python Solution
\nclass Solution:\n    def convertToBase7(self, num: int) -> str:\n        s = ""\n        n = abs(num)\n        while n != 0:\n            s = str(n % 7) + s\n
```\nclass Solution:\n    def convertToBase7(self, num: int) -> str:\n        s = ""\n        n = abs(num)\n        while n != 0:\n            s = str(n % 7) + s\n            n = int(n // 7)\n        if num > 0:\n            return s\n        elif num == 0:\n            return "0"\n        else:\n            return "-" + s\n```
['Python']