Taigar2000

23 no pandas

Dec 25th, 2020
869
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. category = input().strip()
  2. f = open("operations.csv")
  3. res = 0.
  4. for i in f:
  5.     try:
  6.         s = i.split(',')
  7.         if(s[1] == category):
  8.             res += 0.05*float(s[2])
  9.         else:
  10.             res += 0.01*float(s[2])
  11.     except:
  12.         pass # если первая строка - шапка, то тогда в 3-й колонке не число
  13. res = round(res)
  14. print(int(res))
Advertisement
Add Comment
Please, Sign In to add comment