题解 | 添加逗号
添加逗号
https://www.nowcoder.com/practice/f51c317e745649c0900996fd3f683aed
n = input().strip() 哎,笨脑子还是觉得取余最好用,内置函数脑子转不过来的说
ni = n[::-1]
fen = []
for i in range(0,len(ni),3):
fen.append(ni[i:i+3])
resni =','.join(fen)
res = resni[::-1]
print(res)
# n = int(input())
# res = []
# while n>0:
# a = n%1000
# n = n//1000
# res.append(str(a))
# ans = ','.join(reversed(res))
# print(ans)
# n = int(input())
# print('{:,}'.format(n))
文远知行公司福利 588人发布
查看14道真题和解析