Q. Modify previous question so that the program now also prints profit/loss for individual items along with overall profit/loss.
Answer =
total_cost = 0 total_sell = 0 for i in range(10): print( i+1 ,"item") cost = float(input("Enter cost price :-")) sell = float(input("Enter selling price :-")) if cost > sell : print("Loss") else : print("Profit") total_cost += cost total_sell += sell if total_cost > total_sell : print("Loss occurred") else : print("profit occurred")
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )