题解 | 添加逗号
添加逗号
https://www.nowcoder.com/practice/f51c317e745649c0900996fd3f683aed
N = input()
result = []
count = 0
for i in range(len(N) - 1, -1, -1):
result.append(N[i])
count += 1
if count % 3 == 0 and i != 0:
result.append(",")
print("".join(reversed(result)))
查看3道真题和解析
