cs/Practical File/questions/question_17.py
Neil Revin 780baf678e
chore: move question & output files
Move python question files to 'questions' directory
Move output files to 'outputs' directory
Copy output files to 'questions' for ease of viewing

Signed-off-by: Neil <neil@willofsteel.me>
2025-06-24 02:34:07 +05:30

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)