← 返回 amazon 的题目列表SimpleDataClass with Sum and Average Subfunctions
类型:online_judge
amazon
Problem Description
Implement a simple data class with two subfunctions. The requirements for the subfunctions are as follows:
Subfunction One: Accepts a list of integers and returns the sum of all elements in the list.
Subfunction Two: Accepts a list of integers and returns the average of the elements in the list.
Ensure the code is well-organized for collaboration development.
Input
subfunction_one: A list of integers.
subfunction_two: A list of integers.
Output
subfunction_one: Returns an integer representing the sum of all elements in the input list.
subfunction_two: Returns a float representing the average value of the list elements.
Example
subfunction_one([1, 2, 3]) # should return 6
subfunction_two([1, 2, 3]) # should return 2.0
Constraints
The length of the input list does not exceed 1000.
List elements are integers between -1000 and 1000.
Example
Input
[1, 2, 3]