EFFICIENT PYTHON SOLUTION
Given an integer num, return a string of its base 7 representation.\n\n \n# Code\n\nclass Solution:\n    def convertToBase7(self, num: int) -> str:\n        \n 
Given an integer num, return a string of its base 7 representation.\n\n \n# Code\n```\nclass Solution:\n    def convertToBase7(self, num: int) -> str:\n        \n        ans=""\n        temp=num\n        num = abs(num)\n        while(num>0):\n            ans+=str(num%7)\n            num//=7\n        neg_case="-"+ans[::-1]\n        return ans[::-1] if temp>0 else "0" if temp==0 else neg_case\n\n```
['Python3']