av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

Python每日一練之如何計(jì)算你的應(yīng)發(fā)獎(jiǎng)金?

今天主要分享一個(gè)python實(shí)例,大家有興趣也可以做一下~

成都創(chuàng)新互聯(lián)公司長期為上千余家客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對(duì)不同對(duì)象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺(tái),與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為靈臺(tái)企業(yè)提供專業(yè)的網(wǎng)站建設(shè)、成都做網(wǎng)站,靈臺(tái)網(wǎng)站改版等技術(shù)服務(wù)。擁有10多年豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開發(fā)。

需求

企業(yè)發(fā)放的獎(jiǎng)金根據(jù)利潤提成。利潤(I)低于或等于10萬元時(shí),獎(jiǎng)金可提10%;利潤高于10萬元,低于20萬元時(shí),低于10萬元的部分按10%提成,高于10萬元的部分,可提成7.5%;20萬到40萬之間時(shí),高于20萬元的部分,可提成5%;40萬到60萬之間時(shí)高于40萬元的部分,可提成3%;60萬到100萬之間時(shí),高于60萬元的部分,可提成1.5%,高于100萬元時(shí),超過100萬元的部分按1%提成,從鍵盤輸入當(dāng)月利潤I,求應(yīng)發(fā)放獎(jiǎng)金總數(shù)?

思路

分區(qū)間計(jì)算即可。

實(shí)現(xiàn)腳本:

1. JAVA代碼

 
 
 
  1. public class   根據(jù)提成發(fā)放獎(jiǎng)金 {    public static void main(String[] args) {        System.out.print("請(qǐng)輸入利潤金額:");        Scanner in = new Scanner(System.in);        double bonus = 0; //獎(jiǎng)金        double profit = in.nextDouble(); //利潤        in.close();        if(profit<=0) {            System.out.println("輸入錯(cuò)誤");        }        else if(profit > 0 && profit <= 10) { //小于10萬            bonus = profit * 0.1;        } else if(profit > 10 && profit <20) { //10-20萬            bonus =  (profit-10) * 0.075 + 1;        } else if(profit >=20 && profit <40) { //20-40萬            bonus =  (profit-20)*0.05 + 1.75;        } else if(profit >=40 && profit < 60) { //40-60萬            bonus =  (profit-40)*0.03 + 2.75;        } else if(profit >=60 && profit < 100) { //60-100萬            bonus =  (profit-60)*0.015 + 3.35;        } else {            bonus =  (profit-100)*0.001 + 3.95; //大于100萬        }        System.out.println("獎(jiǎng)金為:"+ (bonus*10000) +"元");    }} 

2. python代碼

 
 
 
  1. #!/usr/bin/python#利潤(I)低于或等于10萬元時(shí),獎(jiǎng)金可提10%;利潤高于10萬元,低于20萬元時(shí),低于10萬元的部分按10%提成,#高于10萬元的部分,可提成7.5%;20萬到40萬之間時(shí),高于20萬元的部分,可提成5%;#40萬到60萬之間時(shí)高于40萬元的部分,可提成3%;60萬到100萬之間時(shí),高于60萬元的部分,可提成1.5%,#高于100萬元時(shí),超過100萬元的部分按1%提成,從鍵盤輸入當(dāng)月利潤I,求應(yīng)發(fā)放獎(jiǎng)金總數(shù)?profit=int(input('請(qǐng)輸入利潤金額:\n'))bonus=0thresholds=[100000,100000,200000,200000,400000]rates=[0.1,0.075,0.05,0.03,0.015,0.01]for i in range(len(thresholds)):if profit<=thresholds[i]:bonus+=profit*rates[i]profit=0breakelse:bonus+=thresholds[i]*rates[i]profit-=thresholds[i]bonus+=profit*rates[-1]print('利潤提成金額:%f' %bonus) 

按F5輸出結(jié)果:

如何讓sublime支持帶input()的python程序

1. python文件的界面里點(diǎn)擊上方菜單欄的tools->sublimeREPL->python->python run current file,這時(shí)候就像IDLE一樣,會(huì)彈出一個(gè)新的窗口,而且是可交互的,可以輸入。(這個(gè)操作相當(dāng)于點(diǎn)了下“run”,執(zhí)行代碼,不過每次都要這樣,太麻煩,可以按下面的方法,設(shè)置快捷鍵)

2. 設(shè)置快捷鍵,打開preferences->Key Binding-User,寫入以下內(nèi)容

 
 
 
  1. [       { "keys": ["f5"],           "caption": "SublimeREPL:Python",              "command": "run_existing_window_command",             "args":{"id": "repl_python_run",                                 "file": "config/Python/Main.sublime-menu"                            }     }] 

分享題目:Python每日一練之如何計(jì)算你的應(yīng)發(fā)獎(jiǎng)金?
網(wǎng)頁網(wǎng)址:http://uogjgqi.cn/article/dhspogg.html
掃二維碼與項(xiàng)目經(jīng)理溝通

我們?cè)谖⑿派?4小時(shí)期待你的聲音

解答本文疑問/技術(shù)咨詢/運(yùn)營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流