题解 | 添加逗号

添加逗号

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

import sys

a = list(input())
k = len(a)
#倒序每隔3个遍历
for i in range(k,0,-3):
    if i <k:
        a.insert(i,',')
print(''.join(a))

全部评论

相关推荐

点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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