Write a Python program to calculate profit or loss.

SOLUTION....

# Program to calculate Profit or Loss

# Input
cp = float(input("Enter Cost Price: "))
sp = float(input("Enter Selling Price: "))

# Check Profit or Loss
if sp > cp:
    profit = sp - cp
    print("Profit = ",profit)
elif cp > sp:
    loss = cp - sp
    print("Loss = ",loss)
else:
    print("No Profit No Loss")

OUTPUT

Leave a Reply

Your email address will not be published. Required fields are marked *

sign up!

We’ll send you the hottest deals straight to your inbox so you’re always in on the best-kept software secrets.