Python Practice Example 2 record

Source: Internet
Author: User

题目:企业发放的奖金根据利润提成。利润(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%提成,从键盘输入当月利润I,求应发放奖金总数?
  #-*-Coding:utf-8-*-x = input ("Net profit:") if X.isdigit (): i = Int (x) if i<=100000:b=i*0.1     Print ("bonus", B, "Yuan") elif 100000< i <200000:b=100000*0.1+ (i-100000) *0.075 print ("bonus", B, "Yuan")  Elif 200000< i <= 400000:b = 100000 * 0.1 + (i-100000) * 0.075+ (i-200000) *0.05 print ("bonus", B, "Yuan") elif 400000 < i <= 600000:b = 100000 * 0.1 + (i-100000) * 0.075 + (i-200000) * 0.05 + (i-400000) *0.03 print ("bonus", B, "Yuan") elif 600000 < i <= 10000000:b = 100000 * 0.1 + (i-100000) * 0.075 + (i-2 00000) * 0.05 + (i-400000) *0.03 + (i-600000) *0.015 print ("bonus", B, "Yuan") elif 10000000 < I:B = 100000 * 0.1 + (i-100000) * 0.075 + (i-200000) * 0.05 + (i-400000) *0.03 + (i-600000) *0.015+ (i-1000000) *0.01 print ("bonus", B, "Yuan" ) Else:print ("error")  
x为字符串x.isalnum()  所有字符都是数字或者字母,为真返回 Ture,否则返回 False。x.isalpha()   所有字符都是字母,为真返回 Ture,否则返回 False。x.isdigit()     所有字符都是数字,为真返回 Ture,否则返回 False。x.islower()    所有字符都是小写,为真返回 Ture,否则返回 False。x.isupper()   所有字符都是大写,为真返回 Ture,否则返回 False。x.istitle()      所有单词都是首字母大写,为真返回 Ture,否则返回 False。x.isspace()   所有字符都是空白字符,为真返回 Ture,否则返回 False。

Python Practice Example 2 record

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.