今天跟朋友們一起學習「企業根據利潤提成發獎金」的問題。當利潤(i)低於或等於10萬元時,獎金可提10%;當利潤高於10萬元,低於20萬元時,低於10萬元的部分按10%提成,高於10萬元的部分,可提成7.5%;當20萬到40萬之間時,高於20萬元的部分,可提成5%;當40萬到60萬之間時高於40萬元的部分,可提成3%;當60萬到100萬之間時,高於60萬元的部分,可提成1.5%;當高於100萬元時,超過100萬元的部分按1%提成。問題是求應發放獎金總數是多少?
p_1=int(input("輸入利潤=(萬元)"))
if p_1<10:
c_1=p_1*0.1
elif p_1>10 and p_1<=20:
c_1 = 10 * 0.1 + (p_1-10)*0.075
elif p_1>20 and p_1<=40:
c_1 = 10 * 0.1 + 10 * 0.075 + (p_1-20)*0.05
elif p_1>40 and p_1<=60:
c_1 = 10 * 0.1 + 10 * 0.075 + 20 * 0.05 +(p_1-20)*0.03
elif p_1>60 and p_1<=100:
c_1 = 10 * 0.1 + 10 * 0.075 + 20 * 0.05 + 20 * 0.03 +(p_1-60)*0.015
elif p_1>100:
c_1 = 10 * 0.1 + 10 * 0.075 + 20 * 0.05 + 20 * 0.03 + 40 * 0.015 +(p_1-100)*0.01
print(c_1)
Python 函式 菜鳥教程
python3函式 菜鳥程式設計 計算面積函式 學習他的呼叫函式方式!def area width,height return width height w 4 h 5 print width w,height h,area area w,h width 4 height 5 area 20 pyt...
python 菜鳥教程 Python 元組
python 元組 python的元組與列表類似,不同之處在於元組的元素不能修改。元組使用小括號,列表使用方括號。元組建立很簡單,只需要在括號中新增元素,並使用逗號隔開即可。如下例項 例項 python 2.0 tup1 physics chemistry 1997,2000 tup2 1,2,3,...
python菜鳥教程函式 Python
python modf 函式 描述modf 方法返回x的整數部分與小數部分,兩部分的數值符號與x相同,整數部分以浮點型表示。語法以下是 modf 方法的語法 import math math.modf x 注意 modf 是不能直接訪問的,需要匯入 math 模組,通過靜態物件呼叫該方法。引數x 數...