Generation

generate functionTue, 13 Dec 2022

a list is given arr = [2, 1, 10, 5] Write a function with a for list that sums all the numbers in the list with each other The result should be this: res = 54

def add(arr): res = 0 for num in arr: res += num return res add([2, 1, 10, 5])

Questions about programming?Chat with your personal AI assistant