Python Easy Solution
Code\n\nclass Solution:\n    def convertToBase7(self, num: int) -> str:\n        if num==0:\n            return "0"\n        res=""\n        flg=0\n        if n
# Code\n```\nclass Solution:\n    def convertToBase7(self, num: int) -> str:\n        if num==0:\n            return "0"\n        res=""\n        flg=0\n        if num<0:\n            flg=1\n        num=abs(num)\n        while(num>0):\n            res+=str(num%7)\n            num//=7\n        if flg==1:\n            res+="-"\n        return res[::-1]\n```
['Python3']