leetcode(리트코드)-1556 Thousand Separtator(PYTHON)
 leetcode(리트코드)-1556 Thousand Separtator(PYTHON) 
 leetcode 1556 - Thousand Separtator 문제입니다.
1. 문제
https://leetcode.com/problems/thousand-separator/
2. Input , Output
3. 분류 및 난이도
Eazy 난이도 문제입니다.
4. 문제 해석
- n이 주어집니다.
- 금액에서 천단위로 ‘.’을 찍으시오.
5. code
코드설명
python
1
2
3
4
5
6
7
8
9
10
class Solution:
    def thousandSeparator(self, n: int) -> str:
        n = str(n)
        res = ""
        for i in range(len(n)-1, -1,-1) :
            if (len(n)- i - 1) %3 == 0 :
                    res+= "."
            res+=n[i]
        return res[::-1][:-1]
                   
6. 결과 및 후기, 개선점
필요시 c++로 짜드립니다.
설명이 필요하다면 댓글을 달아주세요.
 This post is licensed under  CC BY 4.0  by the author.