Advertisement
ganiyuisholaafeez

Application of sum function

Feb 29th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. # This function returns the difference between the sum of the first list
  2. # and the second list. It accepts two lists
  3. def sum_difference(first, second):
  4.     return sum(first) - sum(second)
  5.  
  6. print(sum_difference([1, 2, 3], [1, 2, 4]))
  7. print(sum_difference([4, 5], [2, 6, 3]))
  8. print(sum_difference([1], []))
  9.  
  10. # -1
  11. # -2
  12. # 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement