Advertisement
jumboframe

07 Simple loops

May 21st, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. import math
  2.  
  3. n = int(input())
  4. left_sum = 0
  5. right_sum = 0
  6.  
  7. for i in range (0, n):
  8.     left_sum += int(input())
  9.  
  10. for i in range (0, n):
  11.     right_sum += int(input())
  12.  
  13. if left_sum == right_sum:
  14.     print("Yes, sum=%d" % left_sum)
  15. else:
  16.     diff = math.fabs(left_sum - right_sum)
  17.     print("No, diff=%d" % diff)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement