Computer Science, asked by navidha646, 11 months ago

Develop a python program to check whether an item sold is profit or loss

Answers

Answered by HappyHelper
0

Answer:

This is the code:-

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!!!")

Answered by Equestriadash
4

The following codes must be typed in script mode, saved and then executed.

Here, we'll be using the IF - ELSE function. It is a function that decides the result based on a given condition.

It will run the body of the code, only if the condition is true. Otherwise, the 'else' code of the value inputted will be executed.

CODE:

cp = float(input("Enter the cost price of the product:"))

sp = float(input("Enter the selling price of the product:"))

if sp>cp:

   print("Your profit amount is", sp - cp)

else:

   print("Your loss amount is", cp - sp)

OUTPUT:

Attachments:
Similar questions