Advertisement
regergr

Untitled

Jan 10th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. f = open('input.txt', 'r')
  2. d = dict()
  3. for line in f:
  4. s = line.split()
  5. if (s[0] = 'DEPOSIT'):
  6. if (s[1] not in d):
  7. d[s[1]] = 0
  8. d[s[1]] += int(s[2])
  9. elif (s[0] = 'INCOME'):
  10. if (s[1] not in d):
  11. d[s[1]] = 0
  12. elif (s[0] = 'BALANCE'):
  13. print(d[s[1]])
  14. elif (s[0] = 'TRANSFER'):
  15. if (s[1] not in d):
  16. d[s[1]] = 0
  17. if (s[2] not in d):
  18. d[s[2]] = 0
  19. d[s[2]] += int(s[3])
  20. d[s[1]] -= int(s[3])
  21. elif (s[0] = 'WITHDRAW'):
  22. if (s[1] not in d):
  23. d[s[1]] = 0
  24. d[s[1]] -= int(s[2])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement