Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = open('input.txt', 'r')
- d = dict()
- for line in f:
- s = line.split()
- if (s[0] = 'DEPOSIT'):
- if (s[1] not in d):
- d[s[1]] = 0
- d[s[1]] += int(s[2])
- elif (s[0] = 'INCOME'):
- if (s[1] not in d):
- d[s[1]] = 0
- elif (s[0] = 'BALANCE'):
- print(d[s[1]])
- elif (s[0] = 'TRANSFER'):
- if (s[1] not in d):
- d[s[1]] = 0
- if (s[2] not in d):
- d[s[2]] = 0
- d[s[2]] += int(s[3])
- d[s[1]] -= int(s[3])
- elif (s[0] = 'WITHDRAW'):
- if (s[1] not in d):
- d[s[1]] = 0
- d[s[1]] -= int(s[2])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement