Для обленившихся школьников…

1
2
3
4
5
6
7
8
9
#!/usr/bin/python
f = 100000
while f <= 999999:
base = divmod(f, 1000)
sLeft = divmod(base[0], 100)[0]+((divmod(divmod(base[0],100)[1],10))[0])+(base[0]%10)
sRight = divmod(base[1], 100)[0]+((divmod(divmod(base[1],100)[1],10))[0])+(base[1]%10)
if sLeft == sRight:
print(base[0], base[1])
f+=1