Advertisement
molnarjani

Untitled

May 29th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. class Tetel(object):
  2. def __init__(self, file):
  3. self.file = file
  4. self.numbers = []
  5.  
  6. with open(self.file) as f:
  7. for n in f:
  8. try:
  9. self.numbers.append(int(n))
  10. except:
  11. pass
  12. def szamlal(self, func):
  13. return len([x for x in self.numbers if func(x)])
  14.  
  15. def osszegez(self):
  16. return sum(self.numbers)
  17.  
  18. def maxker(self):
  19. return max(self.numbers)
  20.  
  21. def feltmaxker(self, func):
  22. return max([x for x in self.numbers if func(x)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement