Answer to Question #243894 in Python for prime

Question #243894

Profit or Loss

The amount at which a product is sold by the seller is known as the Selling Price. The amount at which the seller has acquired the product is known as the Cost Price.

If the Selling Price of a product is higher than its cost price, then the seller has made a profit. If it is lesser, then the seller has incurred loss selling that product. If the Selling Price is equal to the Cost Price, it means the seller has made No Profit and No loss, by selling the product.

Given Cost price

CP and selling price SP of a product, write a program to determine whether the seller made a profit, incurred loss, or made no profit or loss. Input

The first line is an integer

CP. The second line is an integer SP.Output

Print

Profit or Loss or No Profit - No Loss based on CP and SP.Explanation

In the given example,

CP = 143,SP = 155, So as the selling price is higher than the cost price, the output should be Profit.

Sample Input 1

143

155

Sample Output 1

Profit

Sample Input 2

165

125

Sample Output 2

Loss




1
Expert's answer
2021-09-29T01:32:41-0400

Solution.

cp = int(input())

sp = int(input())

if sp>cp:

    print('Profit')

elif sp<cp:

    print('Loss')

elif sp==cp:

    print('No profit')

Answer:

cp = int(input())

sp = int(input())

if sp>cp:

    print('Profit')

elif sp<cp:

    print('Loss')

elif sp==cp:

    print('No profit')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS