while exercise

  1. Topic: Enterprise commission bonuses based on profits. When profit (I) is less than or equal to 10 million, 10% of the prize can be mentioned; when profit than 10 million, less than 20 million, 10 million commission portion is less than 10%, higher than 100,000 yuan portion, may be 7.5% commission; is between 200,000 to 400,000, more than 20 million portion, may be 5% commission; portion than $ 400,000, may be 3% commission. Profit from the keyboard input of the month, seeking to be paid Total Money?
  2. The first express freight weight 6 million, over the subject 3 yuan / kg (1kg first weight, less than 1kg calculation press), enter the weight of the goods required, calculate shipping
  3. Enter the number of pre-tax salary to calculate the personal income tax payable (without considering tax relief)
  4. Ball free fall from a height of 100 meters, landing bounced back after each half of the original height, find it at the 10th floor, how high off the ground, after a total of how many meters?
  5. It has a fractional column, 1 / 2,2 / 3,4 / 4,8 / 5,16 / 6 ..., 10 of the front and seek
  6. Monkey eating peach issues: the monkey off his first day of a number of peach, half eaten immediately, the next morning in turn eaten by the remaining peach half. Eat every morning before the rest of the day after the half. When the morning of the 10th day want to eat, see only one peach. Seeking first day how many were picking peaches

#第一题分析:
#1.定义变量I存储利润数据
I = int(input("请输入当月利润:"))
if I <= 100000:
    print("应发奖金:",I * 0.1)
elif 100000 < I <= 200000:
    print("应发奖金:",100000 * 0.1 + (I - 100000) * 0.075)
elif 200000 <= I <=400000:
    print("应发奖金:",100000 * 0.1 + 100000 * 0.075 + (I - 200000) * 0.05)
else:
    print("应发奖金:", 100000 * 0.1 + 100000 * 0.075 + 200000 * 0.05 + (I - 400000) * 0.03)
 
#第二题分析:
#1.定义货物重量:变量
weight = float(input("请输入重量:"))
#2.判断运费计算方式
if weight <= 1:
    freight = 6
    print(freight)
else:
    freight = 6 + (weight - 1) * 3
    print(freight)
 
#第三题分析:
#1.定义税前工资:
salary = int(input("请输入工资:"))
#2.应纳税的工资=税前工资-5000-五险一金:
#五险一金:
Five_one_gold = salary * 0.22
#应纳税工资:
should_tax_salary = salary - 5000 - Five_one_gold
#判断个人所得税计算方式:
if salary > 5000:
    if should_tax_salary <= 3000:
        Personal_income_taxes = should_tax_salary * 0.03 - 0
        print("个人所得税:{}元".format(Personal_income_taxes))
    elif 3000 < should_tax_salary <= 12000:
        Personal_income_taxes = should_tax_salary * 0.1 - 210
        print("个人所得税:{}元".format(Personal_income_taxes))
    elif 12000 < should_tax_salary <= 25000:
        Personal_income_taxes = should_tax_salary * 0.2 - 1410
        print("个人所得税:{}元".format(Personal_income_taxes))
    elif 25000 < should_tax_salary <= 35000:
        Personal_income_taxes = should_tax_salary * 0.25 - 2660
        print("个人所得税:{}元".format(Personal_income_taxes))
    elif 35000 < should_tax_salary <= 55000:
        Personal_income_taxes = should_tax_salary * 0.3 - 4410
        print("个人所得税:{}元".format(Personal_income_taxes))
    elif 55000 < should_tax_salary <= 80000:
        Personal_income_taxes = should_tax_salary * 0.35 - 7160
        print("个人所得税:{}元".format(Personal_income_taxes))
    elif should_tax_salary > 80000:
        Personal_income_taxes = should_tax_salary * 0.45 - 15160
        print("个人所得税:{}元".format(Personal_income_taxes))
else:
    Personal_income_taxes = 0
    print("个人所得税:{}元".format(Personal_income_taxes))
 
#第四题分析:
#1.每次落地回弹一半,第一次落地后每次回弹2次
count = 1
height = 100
sum = 0
while count <= 10:
    if count == 1 or count == 10:
        sum += height
    else:
        sum += height * 2
 
    height = height / 2
 
 
    count += 1
print(height)
print(sum)
 
#第五题分析:
#1.找出分数数列的规律:
i = 1
sum = 0
a = 1#分子
b = 2#分母
while i <= 10:
    sum = sum + a / b
    a = a * 2
    b = b + 1
 
    i += 1
print(sum)
 
#第六题分析:
i = 9
a = 1
while i > 0:
    a = 2 * a
    i -= 1
print(a)

Guess you like

Origin www.cnblogs.com/nickchen121/p/11506503.html