hdarwin

cstutoringcenter.com_Reverse of a reverse

Jan 2nd, 2013
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. sum = 0
  2. for file in open("p94.txt", "r"):
  3.     l = file.replace("\n", "").split(" ")
  4.     l[0] = list(l[0])
  5.     l[1] = list(l[1])
  6.     l[0].reverse()
  7.     l[1].reverse()
  8.     sum += int(''.join(list(str(int(''.join(l[0])) + int(''.join(l[1]))))))
  9. print ''.join(list(str(sum))[::-1])
Advertisement
Add Comment
Please, Sign In to add comment