Ask Question
3 February, 10:56

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.

+1
Answers (1)
  1. 3 February, 12:58
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers