Last active
April 22, 2018 23:10
-
-
Save vladimirmyshkovski/7cfc6f5acd163fbcff27c49bcf66baa9 to your computer and use it in GitHub Desktop.
Counter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Counter(object): | |
"""docstring for Counter""" | |
def __init__(self, members, multiplier, amount=1): | |
super(Counter, self).__init__() | |
self.members = members | |
self.multiplier = multiplier | |
def __reprt__(self): | |
return 'members in queue: {}, outgoing members: {}'.format(self.members_in_queue, | |
self.outgoing_count) | |
@property | |
def outgoing_count(self): | |
return (self.members - 1) // self.multiplier | |
@property | |
def members_in_queue(self): | |
return self.members - self.outgoing_count | |
@property | |
def total_paid(self): | |
return self.outgoing_count * self.amount |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
counter = Counter(2, 2)
counter.outgoing_count
counter.members_in_queue