Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Bank_Account:
- def __init__(self, name, bank, balance):
- self.name = name
- self.bank = bank
- self.balance = float(balance)
- command = input().split(' | ')
- bank_account_list = []
- while not command[0] == 'end':
- bank_account = Bank_Account(name=command[1],bank=command[0],balance=float(command[2]))
- bank_account_list.append(bank_account)
- command = input().split(' | ')
- for account in sorted(bank_account_list, key= lambda acc: (-acc.balance,len(acc.bank))):
- print(f'{account.name} -> {account.balance:.2f} ({account.bank})')
Add Comment
Please, Sign In to add comment