Friday, May 6, 2022

Python program to calculate profit %

 def findProfit():

    x = 'a'

    while x != 'n' or x != 'N':

        c = float(input("Enter current market price : "))

        s = float(input("Enter expected sell price  : "))

        a = float((s - c)/c)*100

        formatted_a = "{:.2f}".format(a)

        print("% Profit for buy at " + str(c) + " and expected sell at " + str(s) + " would be : " + str(formatted_a) +"%") 

        print()   

        #x= input("Want to continue (y/n) :") 

        #if x == 'n':

            #exit()

findProfit()

No comments:

Post a Comment

Sacred Thought

5 May 2024 Hari Om Verse 50-51, chapter two:  In this chapter two Shree krishna explains a simple way of living. Free from desires and void ...