话不多说,直接上代码:
result = sum([int(i) for i in input().split(' ')])
result = str(result)[::-1]
output = ''
for index, word in enumerate(result):
if index != 0 and index % 3 == 0 and word != '-':
output += ','
output += word
print(output[::-1])
先求和,然后反转字符串,条件满足就加个逗号,最后再反转字符串输出,ok