Ugly but works
\nclass Solution:\n    def convertToBase7(self, num: int) -> str:\n        s=""\n        x=0\n        p=1\n        if num==0:\n            return "0"\n        i
```\nclass Solution:\n    def convertToBase7(self, num: int) -> str:\n        s=""\n        x=0\n        p=1\n        if num==0:\n            return "0"\n        if num<0:\n            p=-1\n            num*=-1\n        while num>0:\n            t=num//7\n            s+=str(num%7)\n            num//=7\n        \n        x=int(s[::-1])*p\n        return str(x)\n```
[]