[python practice questions] program 2

2. Title: The bonuses issued by the company are based on the profit. When the profit (I) is less than or equal to 100,000 yuan, the bonus can be raised by 10%; when the profit is higher than 100,000 yuan and less than 200,000 yuan, the part less than 100,000 yuan will be commissioned by 10%, and if it is higher than 100,000 yuan 7.5% commission for the part of 200,000 to 400,000 yuan; 5% for the part above 200,000 yuan; 3% for the part above 400,000 yuan when it is between 400,000 and 600,000 yuan ; When between 600,000 and 1,000,000 yuan, the part higher than 600,000 yuan can be commissioned by 1.5%, and when it is higher than 1,000,000 yuan, the part exceeding 1,000,000 yuan will be commissioned at 1%, and the current month's profit I will be input from the keyboard. The total number of bonuses issued?
m = input( ' Please enter profit: ' )

m = float(m)

#When the profit (I) is less than or equal to 100,000 yuan, the bonus can be raised by 10%; 
#When the profit is higher than 100,000 yuan, and less than 200,000 yuan, the part below 100,000 yuan will be commissioned by 10%, and if it is higher than 100,000 yuan For the part of 10,000 yuan, 7.5% of the cocoa will be commissioned; 
# Between 200,000 and 400,000, the part higher than 200,000 yuan can get a 5% commission; 
# Between 400,000 and 600,000, the part higher than 400,000 yuan, 3% commission; 
# When between 600,000 and 1,000,000, the part above 600,000 yuan can be commissioned by 1.5%, 
# When it is above 1 million yuan, the part exceeding 1 million yuan will be commissioned by 1%


lrt = [1000000,600000,400000,200000,100000 , 0]
rate = [0.01,0.015,0.03,0.05,0.075,0.1]
income = 0
for temp in range(0,6):
    if m > lrt[temp]:
        income += (m - lrt[temp])*rate[temp]
        m = lrt[temp]
print (income)

 



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325116831&siteId=291194637