1556. Thousand Separator
Содержание
class Solution:
def thousandSeparator(self, n: int) -> str:
cnt = 0
res = []
while 1:
n, v = divmod(n, 10)
res.append(str(v))
cnt += 1
if n == 0:
break
if cnt == 3:
res.append('.')
cnt = 0
return ''.join(res[::-1])