作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
在这个问题中,它说前 10,000 德拉克不征税,接下来的 20,000 征税 10%,接下来的 40,000 征税 20%,而前 70,000 之后的任何征税 30%。我是 python 的新手,但这是我目前所拥有的。我不确定我哪里出错了。我认为这是因为我没有定义“税”变量,但我不确定。任何帮助将非常感激。谢谢!
**如果用户输入负数,代码也必须终止,我不确定如何将其添加到我的 for 循环中。
def income(drach):
for drach in range(10000):
tax = 0
for drach in range(10000 , 30000):
tax = ((drach - 10000)*0.1)
for drach in range(30000 , 70000):
tax = ((drach - 30000)*0.2) + 2000
for drach in range(70000 , 10**999):
tax = ((drach - 70000)*0.3) + 10000
print tax
最佳答案
我认为这是正确的税收模式:
def tax(income):
tax=0;
if income > 70000 :
tax += (income-70000)* 0.3
income = 70000
if income > 30000 :
tax += (income-30000)* 0.2
income = 30000
if income > 10000 :
tax += (income-10000)* 0.1
return tax;
关于Python——古代税收,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19120775/
需要一个良好且灵活的数据库模式来说明电子商务产品及其费率管理。 最佳答案 我同意 Chris Roberts,OSCommerce是一个很好的起点以及DatabaseAnswers.org . 希望对
这个问题之前有人问过here但没有人给用户一个答案。我也遇到了同样的情况,请问有大神解答过吗? 问题又来了: “我是 iOS 的新手,正在构建一个具有应用内购买功能的应用。该应用尚未准备好(不在应用商
我是一名优秀的程序员,十分优秀!