14 lines
510 B
Python
14 lines
510 B
Python
# Question: Write a Python program to accept cost price and selling price, then print whether there is profit, loss, or no gain.
|
|
|
|
def main(cost_price: float, selling_price: float) -> None:
|
|
if selling_price > cost_price:
|
|
print(f"Profit: {selling_price - cost_price}")
|
|
elif selling_price < cost_price:
|
|
print(f"Loss: {cost_price - selling_price}")
|
|
else:
|
|
print("No gain, no loss.")
|
|
|
|
if __name__ == '__main__':
|
|
main(100.0, 120.0)
|
|
main(150.0, 130.0)
|
|
main(200.0, 200.0) |