Given a list of integers, write a Python function to find and return the sum of all elements in the list.
Example 1:
Input: [1,2,3,4,5]
Output: 15
Example 2:
Input: [10,20,30,40,50]
Output: 150
You can use a looping structure to iterate through each element of the list and add it to a variable.
def sum_list(numbers):
return sum(numbers)
NOTEOwing to browser caching, any code input into the Trinket IDE might carry over across page refreshes or when transitioning between different questions. To commence with a clean slate, either click on the 'Reset Button' found within the IDE's Hamburger icon (☰) menu or resort to using Chrome's Incognito Mode.