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, 24.06.2019 10:00
Which feature of a blog to restore and retrieve older post
Answers: 3
question
Computers and Technology, 24.06.2019 10:30
You're programming an infinite loop. what must you include in your code to prevent crashes? in roblox
Answers: 2
question
Computers and Technology, 24.06.2019 12:30
Select all that apply. what two keys listed below should you use to enter data in an excel worksheet? tab backspace enter right arrow
Answers: 2
question
Computers and Technology, 24.06.2019 17:30
List at least one thing to check for when you're checking the clarity and professionalism of a document.
Answers: 1
You know the right answer?
Implement a container class Stat that stores a sequence of numbers and provides statistical informat...
Questions
question
Mathematics, 18.12.2020 20:50
question
English, 18.12.2020 20:50
Questions on the website: 13722363