Ask Question
13 May, 09:20

Write the definition of a function named sum_list that has one parameter, a list whose elements are of type int. The function returns the sum of the elements of the list as an int.

+2
Answers (1)
  1. 13 May, 10:11
    0
    The code to the given question can be given as:

    Code:

    def sum_list (a) : #define function.

    return sum (a) # return sum of elements.

    Explanation:

    In the above python programming language code firstly we define a function that is "sum_list () " to define any function we use the def keyword.

    In this function, we pass one parameter that is "a" add all elements in the list. To add this number we use the sum function it is the inbuilt function that returns the sum of the elements of the list as an int.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write the definition of a function named sum_list that has one parameter, a list whose elements are of type int. The function returns the ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers