Advertisement
1nikitas

Untitled

Mar 20th, 2022
685
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. class MinStat(object):
  2.     def __init__(self):
  3.         self.lst = [ ]
  4.     def add_number(self,x):
  5.         self.lst.append(x)
  6.     def result(self):
  7.         return min(self.lst) if self.lst else None
  8.  
  9. class MaxStat(MinStat):
  10.    
  11.     def result(self):
  12.         return max(self.lst) if self.lst else None
  13.    
  14. class AverageStat(MinStat):
  15.    
  16.     def result(self):
  17.         return sum(self.lst) / len(self.lst) if self.lst else None
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement