#### Profit or Loss coderinme

Profit or Loss when the Cost price and the Selling Price is given

Profit and loss if Cost Price and Sell price is given

If the selling price is more than the cost price, the difference between them is the profit incurred.

Formula: Profit or Gain = S.P. – C.P.

If the selling price is less than the cost price, the difference between them is the loss incurred.

Formula: Loss = Cost price (C.P.) – Selling Price (S.P.)

In other words, if CP>SP then loss = cp-sp

and if SP>CP then profit = sp-cp

```
#!/usr/bin/env python
cp=float(raw_input("Enter the cost price: "))
sp=float(raw_input("Enter the selling price: "))
if sp > cp :
print 'Profit of Rs ',sp-cp,'.'
elif sp < cp :
print 'Loss of Rs ',cp-sp,'.'
else:
print 'No profit No loss'
```

For more programs on Python, visit our Python Coder Archives

All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme