Write a Python Program to Calculate Profit or Loss

Write a Python Program to Calculate Profit or LossIn this python program, we discuss the calculated profit or loss.

To Calculate Profit or Loss using Elif Statement

In this python program, the user enters the sale amount and actual cost of the product. then calculate the loss amount and profit amount using the elif statement.

# Python Program to Calculate Profit or Loss
 
actual_cost = float(input(" Please Enter the Actual Product Price: "))
sale_amount = float(input(" Please Enter the Sales Amount: "))
 
if(actual_cost > sale_amount):
    amount = actual_cost - sale_amount
    print("Total Loss Amount = {0}".format(amount))
elif(sale_amount > actual_cost):
    amount = sale_amount - actual_cost
    print("Total Profit = {0}".format(amount))
else:
    print("No Profit No Loss!!!")

 

Here is the output of the python program to calculate profit & Loss

 Please Enter the Actual Product Price: 5000
 Please Enter the Sales Amount: 6000
Total Profit = 1000.0

Write a Python Program to find Profit or Loss using Arithmetic Operator

In this python program, we discuss finding Profit or Loss using Arithmetic Operator.

# Python Program to Calculate Profit or Loss
 
actual_cost = float(input(" Please Enter the Actual Product Price: "))
sale_amount = float(input(" Please Enter the Sales Amount: "))
 
if(actual_cost - sale_amount > 0):
    amount = actual_cost - sale_amount
    print("Total Loss Amount = {0}".format(amount))
elif(sale_amount - actual_cost > 0):
    amount = sale_amount - actual_cost
    print("Total Profit = {0}".format(amount))
else:
    print("No Profit No Loss!!!")

 

Here is the output of this program.

Please Enter the Actual Product Price: 500
 Please Enter the Sales Amount: 600
Total Profit = 100.0

Leave a Comment

Exit mobile version