subject

Implement a container class Stat that stores a sequence of numbers and provides statistical information about the numbers. It supports an overloaded constructor that initializes the container either by supplying a list or by giving no arguments (which creates an empty sequence). The class also includes the methods necessary to provide the following behaviors:
>>> s = Stat()
>>> s. add(2.5)
>>> s. add(4.7)
>>> s. add(78.2)
>>> s
Stat([2.5, 4.7, 78.2])
>>> len(s)
3
>>> s. min()
2.5
>>> s. max()
78.2
>>> s. sum()
85.4
>>> s. mean()
28.46666666666667
>>> s. clear()
>>> s
Stat([])
If a Stat is empty, several (but not all) methods raise errors. Note that you won’t literally see "…". You will instead see more information on the error.
>>> s = Stat()
>>>
>>> len(s)
0
>>> s. min()
Traceback (most recent call last):
...
EmptyStatError: empty Stat does not have a min
>>> s. max()
Traceback (most recent call last):
...
hw3.EmptyStatError: empty Stat does not have a max
>>> s. mean()
Traceback (most recent call last):
...
hw3.EmptyStatError: empty Stat does not have a mean
>>> s. sum()
0

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 08:00
Match the items with their respective descriptions.
Answers: 1
question
Computers and Technology, 23.06.2019 21:00
Which task uses a simple parameter?
Answers: 1
question
Computers and Technology, 24.06.2019 00:50
Which of the following is not a key player in the sale of travel products?
Answers: 2
question
Computers and Technology, 24.06.2019 09:50
Create a string list. 2. use console.readline() to collect values of firstname, lastname, street, city, state, zip, save them to list. 3. write a simple linq statement, call method uppercasewords() to change first letter to uppercase. 4. create a foreach statment to display the information. public static string uppercasewords(string value) { char[] array = value.tochararray(); if (array.length > = 1) { if (char.islower(array[0])) { array[0] = char.toupper(array[0]); } } for (int i = 1; i < array.length; i++) { if (array[i - 1] == ' ') { if (char.islower(array[i])) { array[i] = char.toupper(array[i]); } } } return new string(array);
Answers: 3
You know the right answer?
Implement a container class Stat that stores a sequence of numbers and provides statistical informat...
Questions
question
French, 30.04.2021 22:20
question
Biology, 30.04.2021 22:20
question
Social Studies, 30.04.2021 22:20
question
English, 30.04.2021 22:20
Questions on the website: 13722360