Advertisement
jbn6972

Untitled

Oct 11th, 2022
790
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. def profitLoss(n,p):
  2.     profit = []
  3.     selling = []
  4.     total = 0
  5.    
  6.     for product in p:
  7.         a,x,y = product
  8.         profit.append(a + (a * (x/100)))
  9.         selling.append(profit[-1] - (profit[-1] * (y/100)))
  10.         total += a
  11.        
  12.     ans = int(total - sum(selling))
  13.     if ans > 0 :
  14.         print("Loss",ans)
  15.     else:
  16.         print("Profit",abs(ans))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement