Loading...
Loading...
Tax is charged slab by slab. Income up to 250000 pays no tax. The part from 250001 to 500000 is taxed at 5%. The part from 500001 to 1000000 is taxed at 20%. The part above 1000000 is taxed at 30%.
Given the yearly income, print the total tax. Use whole-number arithmetic: multiply first and then divide with //, for example part * 5 // 100.
Example 1
Input
850000
Output
82500
Example 2
Input
200000
Output
0
Try the problem first. Open one hint at a time.
The tax on a higher income includes the full tax of every lower slab. Work out the tax at each slab edge: 0, 12500 and 112500.
Use an elif ladder from the lowest slab up. In each branch, add the earlier slabs and the part of the income inside this slab.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor