题解 | 添加逗号

添加逗号

https://www.nowcoder.com/practice/f51c317e745649c0900996fd3f683aed

n = input()
m = n[::-1]
count = 0
s = ""
for i in m:
    count += 1
    if count % 3 == 0 and count != len(m):
        s += i + ","
    else :
        s += i
print(s[::-1])

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务