def find_highest_bribe_taker(self): print('The most greedy deputy is:') deputies = [dep for dep in self.deputies if dep.bribe_taker] deputies.sort(key=Sorting('bribe_amount')) print(deputies[-1], 'grivnjas taken: {}'.format(deputies[-1].bribe_amount))
def find_all_bribe_takers(self): print('The following bribe_takers have been found...') deputies = [dep for dep in self.deputies if dep.bribe_taker] deputies.sort(key=Sorting('bribe_amount')) for deputy in deputies: print(deputy, 'grivnjas taken: {}'.format(deputy.bribe_amount))
def find_all_deputies(self): deputies = list(self.deputies) deputies.sort(key=Sorting('first_name', 'last_name')) print('List of all deputies...') for deputy in deputies: print(deputy)
def show_biggest_bribe_taker(self): all_deputats = set() for fraction in self.fractions: all_deputats.union(fraction.deputats) sorted_list = list(all_deputats) sorted_list.sort(key=Sorting('bribes_amount')) max_bribe_amount = sorted_list[0] if max_bribe_amount.bribe_taker: print(max_bribe_amount)
def higher_bribe_taker(self): bribe_takers = [] for fraction in self.fractions: for deputy in fraction.deputies: if deputy.bribe_taker: bribe_takers.append(deputy) bribe_takers.sort(key=Sorting('bribe_amount')) print(bribe_takers[-1], 'grivnjas taken: {}'.format(bribe_takers[-1].bribe_amount))
def print_all_deputats(self): sorted_list = list(self.deputats) sorted_list.sort(key=Sorting('name', 'surname')) for dep in sorted_list: print(dep)
def get_biggest_bribe_taker(self): sorted_list = list(self.deputats) sorted_list.sort(key=Sorting('bribes_amount')) max_bribe_amount = sorted_list[0] if max_bribe_amount.bribe_taker: return max_bribe_amount
def print_all_bribe_takers(self): sorted_list = list(self.deputats) sorted_list.sort(key=Sorting('bribes_amount')) for dep in sorted_list: if dep.bribe_taker: print(dep)