840613937
发表于 2020-3-12 03:24:21
whitney7
发表于 2020-3-17 15:59:20
n = int(input('请输入当月净利润:'))
pro =
mon = #成长整型
sum1 = 0
for i in range(0,6):
if n > mon:
sum1 += (n - mon) * pro
print((n - mon) * pro)
n = mon
print('总提成为:',sum1)
流浪的杰
发表于 2020-3-23 21:58:17
a = int(input('利润'))
if a <= 100000:
print (a*0.1)
elif a <= 200000:
print (10000+(a-100000)*0.075)
elif a <= 400000:
print (17500+(a-200000)*0.05)
elif a <= 600000:
print (27500+(a-400000)*0.03)
elif a <= 1000000:
print (33500+(a-600000)*0.015)
elif a > 1000000:
print (39500+(a-1000000)*0.01)
十月故里
发表于 2020-4-1 18:45:47
i=int(input('净利润/万元'))
t=0
arr=
rat=
rang=list(zip(arr,rat))
for j in rang:
if i>j:
t+=(i-j)*j
i=j
print(t,'万元')
rofok
发表于 2020-4-8 00:40:42
# 企业发放的奖金根据利润提成。利润(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,求应发放奖金总数?
print("第一种方法")
profit = float(input("输入利润(单位万元):"))
if profit < 0:
print('输入错误请重新输入')
profit = float(input("输入利润(单位万元):"))
bonus = 0.0
if profit <= 10:
bonus = profit*0.1
elif (profit > 10) and (profit <= 20):
bonus = (profit-10)*0.075 + 10*0.1
elif (profit > 20) and (profit <= 40):
bonus = (profit-20)*0.05 + 10*0.075 + 10*0.1
elif (profit > 40) and (profit <= 60):
bonus = (profit - 40) * 0.03 + 10 * 0.075 + 10 * 0.1 + 20*0.05
elif (profit > 60) and (profit <= 100):
bonus = (profit - 60) * 0.015 + 10 * 0.075 + 10 * 0.1 + 20 * 0.05 + 20*0.03
elif profit > 100:
bonus = (profit - 100) * 0.01 + 10 * 0.075 + 10 * 0.1 + 20 * 0.05 + 20*0.03 + 40*0.015
print("当月利润为", profit, "万元", "奖金为", bonus, "万元")
print("第二种方法")
# 输入利润
def inputProfit():
try:
profit = float(input("输入利润(单位万元):"))
return profit
except:
print("输入错误")
return inputProfit()
#计算奖金
profit = inputProfit()
profits =
#profits.reverse()
donuslike =
#donuslike.reverse()
def calculateBonus():
bonus2 = 0.0
if len(profits) != len(donuslike):
print("程序异常")
return
for i in range(len(profits)-1):
if (profit > profits) and (profit >= profits):
bonus2 = bonus2 + (profits-profits)*donuslike
elif (profit > profits) and (profit < profits):
bonus2 = bonus2 + (profit - profits)*donuslike
# 单独比较最大值
if profit >= profits:
bonus2 = bonus2 + (profit - profits)*donuslike
return bonus2
print("当月利润为", profit, "万元", "奖金为", calculateBonus(), "万元")
雁过无痕y
发表于 2020-4-18 16:52:23
I = int(input())
if I <= 100000:
award = I * 0.1
elif I <= 200000:
award = 10000 * 0.1 + 0.75 * (I - 100000)
elif I <= 400000:
award = 10000 * 0.1 + 0.75 * 200000 + 0.5 * (I - 200000)
elif I <= 600000:
award = 10000 * 0.1 + 0.75 * 200000 + 0.5 * 400000 + 0.3 * (I - 400000)
elif I <= 1000000:
award = 10000 * 0.1 + 0.75 * 200000 + 0.5 * 400000 + 0.3 * 600000 + 0.15 * (I - 600000)
elif I > 1000000:
award = 10000 * 0.1 + 0.75 * 200000 + 0.5 * 400000 + 0.3 * 600000 + 0.15 * 1000000 + 0.01 * (I - 1000000)
print(award)
可惜我只会elif
逸野散人
发表于 2020-4-24 11:06:39
def my_money(temp):
t1 = 10*0.1
t2 = 10*0.075
t3 = 20*0.005
t4 = 20*0.003
t5 = 40*0.0015
if temp<= 10:
return temp*0.1
elif 10 < temp <= 20:
return t1 + (temp-10)*0.075
elif 20 < temp <= 40:
return t1 + t2 + (temp-20)*0.005
elif 40 < temp <= 60:
return t1+t2+t3+(temp-40)*0.003
elif 60 < temp <= 100:
return t1+t2+t3+t4+(temp-60)*0.0015
elif temp > 100:
return t1+t2+t3+t4+t5+(temp-100)*0.001
temp = int(input('请输入当月利润(单位万元): '))
if temp <= 0:
print('公司该倒闭了')
else:
money = my_money(temp)
print('奖金数是(万元): ')
print(money)
xucl
发表于 2020-4-25 17:28:22
"""
企业发放的奖金根据利润提成。利润(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,求应发放奖金总数?
"""
def calcbonus(money):
total = 0
before = 0
#各段利润奖金分配比例
profit = [(100000, 0.1), (200000, 0.075), (400000, 0.05), (600000, 0.03), (1000000, 0.015)]
if (0 >= money):
print("The param(%s) is invalid!" % (str(money)))
return -1
for temp, pre in profit:
if (money >= temp):
total += (temp-before)*pre
before = temp
else:
break
total += (money - before) * pre
return total
if __name__ == "__main__":
while True:
money = int(input("请输入当月总利润(元):"))
result = calcbonus(money)
if -1 != result:
print("当月应发奖金为%.4f(元)"%(result))
尔东方
发表于 2020-4-26 22:17:56
profit=int(input())
if profit<=100000:
money=profit*0.1
elif 100000<=profit<=200000:
money=100000*0.1+(profit-100000)*0.075
elif 200000<=profit<=400000:
money=(profit-400000)*0.05+100000*0.1+(profit-100000)*0.075
elif 400000<=profit<=600000:
money=(profit-400000)*0.03+(profit-400000)*0.05+100000*0.1+(profit-100000)*0.075
elif 600000<=profit<=1000000:
money=(profit-600000)*0.015+(profit-400000)*0.03+(profit-400000)*0.05+100000*0.1+(profit-100000)*0.075
else:
money=(profit-1000000)*0.01+(profit-600000)*0.015+(profit-400000)*0.03+(profit-400000)*0.05+100000*0.1+(profit-100000)*0.075
print(money)
江少
发表于 2020-5-8 11:44:45
while 1:
number = raw_input('请输入一个数字:')
n = int(number)
if int(n) <= 100000:
print n * 0.1
elif 100000 < int(n) <= 200000:
print (100000 * 0.1)+ (int(n)-100000)*0.075
elif 200000 < int(n) <= 400000:
print (100000*0.1+100000*0.075)+(int(n)-200000)*0.05
elif 400000< int(n) <= 600000:
print(100000*0.1+100000*0.075+200000*0.05)+(int(n)-400000)*0.03
elif 600000< int(n) <= 1000000:
print (100000*0.1+100000*0.075+200000*0.05+200000*0.03)+(int(n)-600000)*0.015
elif int(n)>1000000:
print(100000*0.1+100000*0.075+200000*0.05+200000*0.03+400000*0.015)+(int(n)-1000000)*0.01
清风明月星
发表于 2020-5-9 11:28:24
gopythoner 发表于 2017-3-31 23:54
虽然你的这个很看起来很简约,但是不符合一般的数学思维逻辑
在数学里面应该是这样:
在编程的时候,应该使用计算思维好一些,因为这样能发挥出计算机的优势,节省人的精力。
ForPorsche
发表于 2020-5-21 23:08:23
I = float(input('输入当月利润:(单位:万):'))
award = 0
if I <= 10:
award = 0.1 * I
elif I < 20:
award = 0.1 * 10 + (I - 10)* 0.075
elif I < 40:
award = 0.1 * 10 + 10 * 0.075 + (I - 20) * 0.05
elif I < 60:
award = 0.1 * 10 + 10 * 0.075 + 20 * 0.05 + (I - 40) * 0.03
elif I < 100:
award = 0.1 * 10 + 10 * 0.075 + 20 * 0.05 + 20 * 0.03 + (I - 60) * 0.015
else:
award = 0.1 * 10 + 10 * 0.075 + 20 * 0.05 + 20 * 0.03 + 40 * 0.015 + (I - 100) * 0.01
print('应发奖金%.2f万' % award)
鲨鱼辣椒1
发表于 2020-7-15 10:35:32
本帖最后由 鲨鱼辣椒1 于 2020-7-15 10:49 编辑
def bonus():
a = int(input("请输入利润:"))
b = 100000 * 0.1 # 低于10W元部分
c = 100000 * 0.075 # 10 - 20部分
d = 100000 * 0.05
e = 100000 * 0.03
f = 100000 * 0.015
if a <= 100000:
h = a * 0.1
elif 100000 < a < 200000:
h = (a - 100000) * 0.075 + b
elif 200000 < a < 400000:
h = (a - 200000) * 0.05 + b + c
elif 400000 < a < 600000:
h = (a - 400000) * 0.03 + b + c + d
elif 600000 < a < 1000000:
h = (a - 600000) * 0.015 + b + c + d + e
else:
h = (a - 1000000) * 0.01 + b + c + d + e + f
print("获得的奖金为:{}。".format(h))
while True:
i = input("请问您要计算奖金吗?:")
if i == "YES":
bonus()
else:
break
逃兵
发表于 2020-12-18 08:50:50
本帖最后由 逃兵 于 2020-12-18 08:53 编辑
I = int(input('当月利润I(万元)='))
if I<=10:
bonus = 10*0.1
elif 10<I<=20:
bonus = 10*0.1 + (I-10) * 0.075
elif 20<I<=40:
bonus = 10*0.1 + (20-10) * 0.075+(I-20)*0.05
elif 40<I<=60:
bonus = 10*0.1 + (20-10) * 0.075+(40-20)*0.05 + (I-40)*0.03
elif 60<I<=100:
bonus = 10*0.1 + (20-10) * 0.075+(40-20)*0.05 + (60-40)*0.03 + (I-60)*0.015
else:
bonus = 10*0.1 + (20-10) * 0.075+(40-20)*0.05 + (60-40)*0.03 + (100-60)*0.015 + (I-100) * 0.01
bonus = bonus*10000
print(bonus)
逸野散人
发表于 2021-2-10 20:08:43
有没有大佬会用递归写的{:5_109:}
def MyMoney(num):
num1 = 10 * 0.1
num2 = 10 * 0.075
num3 = 20 * 0.05
num4 = 20 * 0.03
num5 = 40 * 0.015
if num <= 10:
returnnum*0.1
elif 10 < num <= 20:
return num1 + (num - 10)*0.075
elif 20 < num <= 40:
return num1 + num2 +(num - 20)*0.05
elif 40 < num <= 60:
returnnum1 + num2 + num3 + (num - 40)*0.03
elif 60 < num <= 100:
returnnum1 + num2 + num3 + num4 + (num - 60)*0.015
elif 100 < num:
return num1 + num2 + num3 + num4 + num5 + (num - 100)*0.01
salary = int(input("请输入利润(万元):"))
result = MyMoney(salary)
EndResult = result * 10000
print("今年的利润为:%d 万元"%salary,"\n","奖金应发放为:%d 元"%EndResult)
一块钱赫赫
发表于 2021-2-16 15:25:04
all = int(input("请输入公司所得利润:"))
bene =
rate =
money = 0
for i in range(6):
if all > bene:
money += (all - bene)*rate
money = bene
print(money)
宇郁顺
发表于 2024-9-12 11:49:59
i = int(input("利润"))
if i <= 10:
a = i * 0.1
elif 10 < i <= 20:
a = i * 0.075
elif 20 < i <= 40:
a = i * 0.05
elif 40 < i <= 60:
a = i * 0.03
elif 60 < i <= 100:
a = i * 0.015
elif 100 < i:
a = i * 0.01
print(a)