I'm making a class dataset. In it, I'm trying to set the minimum max and the mean. In my given test, I am asking the user to input as many grades as they would like so what I did, for example in minimum is this..
class Dataset(object): def __init__(self, grade): self.grade= def min(self): try: if int(input)<= self.grade: return int(input) except: pass
using this test,
from Dataset import Dataset def main(): print('This is a program to compute the min, max, mean and') print('standard deviation for a set of numbers.\n') while True: xStr = input('Enter a number (<Enter> to quit): ') if xStr == '': break try: x = float(xStr) except ValueError: print('Invalid Entry Ignored: Input was not a number') continue data = Dataset(xStr) data.add(x) print('Min:', data.min()) print('Max:', data.max()) print('Mean:', data.average()) print('Standard Deviation:', data.std_deviation()) if __name__ == '__main__': main()
which was given by the professor. The output is that there is no minimum. What am I doing wrong?