Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. def deposit(name, sum):
  2. bank[name] = bank.get(name, 0) + int(sum)
  3. def withdraw(name, sum):
  4. bank[name] = bank.get(name, 0) - int(sum)
  5. def balance(name):
  6. if name not in bank:
  7. print('ERROR')
  8. else:
  9. print(bank[name])
  10. def income(percent):
  11. for k, v in bank.items():
  12. if v > 0:
  13. bank[k] = int(v * ((int(percent) / 100) + 1))
  14. bank = dict()
  15.  
  16. operations_count = int(input())
  17.  
  18. for i in range(operations_count):
  19. line = input().split()
  20. if 'BALANCE' in line:
  21. balance(line[1])
  22. elif 'DEPOSIT' in line:
  23. deposit(line[1], line[2])
  24. elif 'WITHDRAW' in line:
  25. withdraw(line[1], line[2])
  26. elif 'INCOME' in line:
  27. income(line[1])
  28. else:
  29. withdraw(line[1], line[3])
  30. deposit(line[2], line[3])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement