Python Forum
Profit on Pricing Solver
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Profit on Pricing Solver
#1
Finally created this program for the "Pricing Calculations" solver.
This Profit for Pricing solver ask for any two knowns values and program
will solve for the remaining two values from Cost, Price, Markup and Margin.

User enter 0 (zero) for the two unknowns values

Program will ask for four values in this order:

Cost -> Price -> Markup -> Margin -> display answer with profit amount.

print("==========================================")
print("  Profit on Pricing Calculator")
print("  Enter Zero for the Two Unknown Valiables")
print("==========================================")
print("   Cost -> Price -> Markup -> Margin      ")
print("==========================================")

CST = float(input("Enter Cost  : "))
SEL = float(input("Enter Price : "))
MUP = float(input("Enter Markup: "))
MAR = float(input("Enter Margin: "))

p = 100 # constant used for percentage

if CST and SEL != 0: # if both true
   MAR = float(p * ((SEL - CST) / SEL))
   MUP = float(p * ((SEL - CST) / CST))

if MAR == 0: # if true compute Margin
   MAR = float(MUP / (1 + (MUP / p)))
   
# constant to plug into remaining formulas
q = 1 - (MAR / p)
   
if MUP == 0: # if true compute Markup
   MUP = float(MAR / q)

if CST == 0: # if true compute Cost
   CST = float(SEL * q)
   
if SEL == 0: # if true compute Price
   SEL = float(CST / q)

print("==================")        
print("Cost   = ", "%1.2f"%(CST))
print("Price  = ", "%1.2f"%(SEL))
print("Markup = ", "%1.1f"%(MUP), "%")
print("Margin = ", "%1.1f"%(MAR), "%")
print("==================")
print("Profit = ", "%1.2f"%(SEL - CST))
print("==========================================")
Here is a quick look with this program:
https://trinket.io/python3/7b7ef02082?outputOnly=true

Remark:
This program can also calculate just between Markup and Margin.
Cost = 0, Price = 0 and input value either one of the Markup or Margin.

I try to use this program to create GUI by Tkinter but not successful yet.

Gamo 7/2020
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Anagram Solver with Python BlazingWarlord 2 2,784 May-29-2021, 04:14 AM
Last Post: BlazingWarlord
  pricing app (technically it estimates home prices but it is tweakable) mepyyeti 0 1,900 Mar-11-2018, 10:10 PM
Last Post: mepyyeti

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020