Sum of Even Pairs in List

Published by Werdna in

Given a list with an even amount of numbers, return true if the sum of two numbers in the list is even and false if the sum of two numbers in the list is odd.

To illustrate:

11, 15, 6, 8, 9, 10
  • 11 + 15 = 26 = true
  • 15 + 6 = 21 = false
  • 6 + 8 = 14 = true

Examples

odd_sum_list([11, 15, 6, 8, 9, 10]) ➞ [true, false, true, false, false]

odd_sum_list([12, 21, 5, 9, 65, 32]) ➞ [false, true, true, true, false]

oddSumArr([1, 2, 3, 4, 5, 6]) ➞ [false, false, false, false, false]

Notes

  • Remember that the length of all the lists will be an even number, so it is not necessary to measure lengths.
  • If you are stuck, look in the Resources tab.
Watch a quick demo on how Edabit works.