Files
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

1.3 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
6994cff2290543b3aec9f510 Challenge 211: Array Sum 29 challenge-211

--description--

Given an array of numbers, return the sum of all the numbers.

--hints--

sum_array([1, 2, 3, 4, 5]) should return 15.

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(sum_array([1, 2, 3, 4, 5]), 15)`)
}})

sum_array([42]) should return 42.

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(sum_array([42]), 42)`)
}})

sum_array([5, -2, 7, -3]) should return 7.

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(sum_array([5, -2, 7, -3]), 7)`)
}})

sum_array([203, 145, -129, 6293, 523, -919, 845, 2434]) should return 9395.

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(sum_array([203, 145, -129, 6293, 523, -919, 845, 2434]), 9395)`)
}})

sum_array([0, 0]) should return 0.

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(sum_array([0, 0]), 0)`)
}})

--seed--

--seed-contents--

def sum_array(numbers):

    return numbers

--solutions--

def sum_array(numbers):

    return sum(numbers)