python计算所得税程序_Python中的所得税程序

我一直在试图解决一个编码实验室的练习,但我不断在我的程序错误。请帮忙看一下这个代码,告诉我它出了什么问题。

问题:Country X calculates tax for its citizens using a graduated scale rate as shown below:

Yearly Income: 0 - 1000

Tax Rate: 0%

Yearly Income: 1,001 - 10,000

Tax Rate: 10%

Yearly Income: 10,001 - 20,200

Tax Rate: 15%

Yearly Income: 20,201 - 30,750

Tax Rate: 20%

Yearly Income: 30,751 - 50,000

Tax Rate: 25%

Yearly Income: Over 50,000

Tax Rate: 30%

Write a Python function named calculate_tax that will take as an

argument, a dictionary containing key-value pairs of people's names as

the keys and their yearly incomes as the values.

The function should return a dictionary containing key-value pairs of

the same people’s names as keys and their yearly tax bill as the

values. For example, given the sample input below:{

‘Alex’: 500,

‘James’: 20500,

‘Kinuthia’: 70000

} The output would be as follows:

{

‘Alex’: 0,

‘James’: 2490,

‘Kinuthia’: 15352.5

}

The tax for James would be calculated as follows:

The first 1000 (1000 - 0)

Calculation: 1,000 * 0%

Tax: 0

The next 9000 (10,000 - 1,000)

Calculation: 9,000 * 10%

Tax:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值