What other approach can I use instead of 'lambda'
def calculate_fees(self):
return sum(map(lambda x: x.fee, self.bookings.values()))
def calculate_donations(self):
return sum(map(lambda x: x.donation, self.bookings.values()))
def __str__(self):
output = 'Event: {0} {1} {2}\n'.format(self.event_id, self.event_date, self.venue) + \
'Miles: {0}\n'.format(self.miles) + \
'Max Places: {0}\n'.format(self.max_places) + \
'Basic Fee: £{0}'.format(self.basic_fee)
if self.bookings:
output += '\nRunners:\n' + \
'\n'.join(map(lambda x: '{0} {1}'.format(x.runner_id, x.club_id), self.bookings.values()))
return output