Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This function returns the list with the greater sum
- def greater_sum(first, second):
- greater = first # Setting the base of the comparison
- if sum(first) < sum(second): # The condition
- greater = second
- return greater
- print(greater_sum([1, 2, 3], [1, 2, 4]))
- print(greater_sum([4, 5], [2, 6, 3]))
- print(greater_sum([1], []))
- print(greater_sum([1, 2, 9], [1, 2, 5]))
- # [1, 2, 4]
- # [2, 6, 3]
- # [1]
- # [1, 2, 9]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement