cs/practical-file/answers/question_17.py

11 lines
468 B
Python

# Question: Write a Python program to accept cost price and selling price, then print whether there is profit, loss, or no gain.
cost_price = float(input("Enter the cost price: "))
selling_price = float(input("Enter the selling price: "))
if selling_price > cost_price:
profit = selling_price - cost_price
print(f"There is a profit of: {profit}")
elif selling_price < cost_price:
loss = cost_price - selling_price
print(f"There is a loss of: {loss}")