equivalent of Excel Goal Seek function in Python or MYSQL -
how implement excel goal seek function python or mysql?
this scenario :
in agency work buy items , sell online store, online store apply 3 different fees , calculated on final price. agency wants earn fixed amount of money on final price, need calculate final price fees , amount want earn.
i know amount money want earn , initial price, , fees in % , don't know @ price need sell items earn specific amount of money.
with excel use goal seek function calculate final price fees , fixed amount agency want earn, python or mysql.
ex :
a1 = 270.0$ # price buy item c2 = 3.50$ # shipping price c3 = 0.10 # fee of store in percentage (10%) c4 = 0.03 # fee credit card (0.3%) c5 = 0.35$ # fixed fee store 0.35$ d1 = 5$ # amount want earn when sell item x = ? # final price need sell item earn d1
thanks help
in python following. note formumla may need adjusting
a1 = 270.00 # price buy item in $ c2 = 3.50 # shipping price in $ c3 = 0.10 # fee of store in percentage (10%) c4 = 0.03 # fee credit card (0.3%) c5 = 0.35 # fixed fee store $0.35 d1 = 5.00 # amount want earn when sell item in $ x = 0.00 # final price need sell item earn d1 while true: # assumed formula - may need adjusted match criteria earnt_amount = ((x - a1 - c2) * (1 - c3 - c4)) - c5 x += 0.01 if earnt_amount >= d1: break print ('price "x" should be: {0}'.format(x))
Comments
Post a Comment