✅0ms python3 solution || beats 100%
Beats 100% 0ms in python3converting to base 7 is of the form1.check if the number is zero (base condition) then return 02.take a list, l to store the remainders
# Beats 100% 0ms in python3
## converting to base 7 is of the form 
![image.png](https://assets.leetcode.com/users/images/7d7e9574-09ff-4ad6-b070-dea8406f0f3d_1735067024.1347406.png)

1.check if the number is zero (base condition) then return 0

2.take a list, l to store the remainders after division

3.append the remainder into l.

4.reduce the number to num//7

5.at num becomes zero, print the result to get the output 

# Code
```python3 []
class Solution:
    def convertToBase7(self, num: int) -> str:
        if num == 0:
            return "0"
        l = []  
        sign = 1 if num >= 0 else -1
        num = abs(num) 
        while num > 0:
            l.append(str(num % 7))
            num //= 7 
        result = ''.join(reversed(l))
        return '-' + result if sign == -1 else result

```
['Python3']