Create a function that will convert gross salary to net salary in an imaginary country. Name the function convert_gross_to_net(salary)
. The function should print the following information:
Your salary gross: {x}
Salary after social contribution: {y}
Net salary after tax: {z}
First, create two helper functions: calculate_social_contribution(amount)
and calculate_tax(amount)
, and use them later in your main function.
The calculate_social_contribution(amount)
function returns:
0
for amounts below 200.
100
for amounts greater than 200 and less than 1000.
200
for amounts greater than or equal 1000.
The calculate_tax(amount)
function should return the tax, which equals:
- 10% of
amount
if the amount is up to 3000.
300
+ 20% of all the amount above 3000
if amount is greater than 3000.
Then, finally write the convert_gross_to_net(salary)
function. The function should print the following information:
Your salary gross: {x}
Salary after social contribution: {y}
Net salary after tax: {z}
The following rules apply:
First, the social contribution is calculated. Once the social contribution has been deducted from the salary, you need to calculate and subtract the tax from the remaining amount. Use the helper functions to do it.
For instance, for salary = 500: