Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open("finances.txt", mode="rt", encoding="utf-8") as file:
- strings = file.readlines()
- outnum = 0
- for s in strings:
- tmp = s.split()
- if s[0] == '+':
- outnum += int(s[1])
- elif s[0] == '-':
- outnum -= int(s[1])
- print(outnum)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement