HomeSoftware DevelopmentPython Program to calculate Revenue Or Loss

Python Program to calculate Revenue Or Loss


View Dialogue

Enhance Article

Save Article

Like Article

View Dialogue

Enhance Article

Save Article

Like Article

Given the Price Value(CP) and Promoting Value(SP) of a product. The duty is to Calculate the Revenue or Loss.
Examples: 
 

Enter: CP = 1500, SP = 2000
Output: 500 Revenue

Enter: CP = 3125, SP = 1125
Output: 2000 Loss

Method: 
 

Revenue = (Promoting Value - Price Value)
Loss = (Price Value - Promoting Value)

 

Beneath is the required implementation: 
 

Python 3

  

def Revenue(costPrice, sellingPrice) :

  

    revenue = (sellingPrice - costPrice)

  

    return revenue

  

def Loss(costPrice, sellingPrice) :

  

    Loss = (costPrice - sellingPrice)

  

    return Loss

  

if __name__ == "__main__" :

  

    costPrice, sellingPrice = 1500, 2000

  

    if sellingPrice == costPrice :

        print("No revenue nor Loss")

  

    elif sellingPrice > costPrice :

        print(Revenue(costPrice, 

                     sellingPrice), "Revenue")

  

    else :

        print(Loss(costPrice, 

                   sellingPrice), "Loss")

OUTPUT : 
 

500 Revenue

Time Complexity: O(1)
Auxiliary House: O(1)
 

Please refer full article on Program to calculate Revenue Or Loss for extra particulars!

RELATED ARTICLES

Most Popular

Recent Comments