ilm*_*etu 0 python mysql math excel function
如何使用Python或mysql 实现Excel目标搜索功能?
这是场景:
在我工作的代理商中,他们先购买商品,然后再卖给在线商店,该在线商店将根据最终价格计算3种不同的费用。该代理商希望以最终价格赚取固定金额的钱,因此我需要计算最终价格以及他们想要赚取的费用和金额。
我知道他们想要赚取的金额和初始价格,以及以%为单位的费用,我不知道我需要以多少价格出售这些物品才能赚取特定的金额。
借助excel,他们使用目标搜索功能来计算最终价格,其中包含代理商要赚取的所有费用和固定金额,我想使用python或mysql来实现。
例如:
a1 = 270.0$ # This is the price they buy the item
c2 = 3.50$ # This is the shipping Price
c3 = 0.10 # This is the FEE of the store in percentage (10%)
c4 = 0.03 # This is the FEE for the credit card (0.3%)
c5 = 0.35$ # This is the Fixed FEE for the store 0.35$
d1 = 5$ # This is the amount they want to earn when they sell the item
x = ? # This is the final price they need to sell the item for earn d1
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助
在Python中,您可以执行以下操作。请注意,公式可能需要调整
a1 = 270.00 # This is the price they buy the item in $
c2 = 3.50 # This is the shipping Price in $
c3 = 0.10 # This is the FEE of the store in percentage (10%)
c4 = 0.03 # This is the FEE for the credit card (0.3%)
c5 = 0.35 # This is the Fixed FEE for the store $0.35
d1 = 5.00 # This is the amount they want to earn when they sell the item in $
x = 0.00 # This is the final price they need to sell the item for earn d1
while True:
# Assumed Formula - this may need to be adjusted to match your 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))
Run Code Online (Sandbox Code Playgroud)