← Problem library

Arrays · Python

Sum an Array

EasyArraysUnsolved

Problem

Write a function that returns the sum of every integer in nums.

Example input

nums = [2, 4, 6]

Example output

12

Constraints

1 <= len(nums) <= 1000; -10,000 <= nums[i] <= 10,000

Python workspace

Reset code

Execution uses a timed child process in a temporary directory. It is development-only isolation, not a production sandbox.