Write a function called calculate_tax that takes 3 arguments: your age, salary, and current job designation.
Your first task is to take these arguments as user input and pass these values to the function.
Your second task is to implement the function and calculate the tax as the following conditions:
NO TAX IF YOU ARE LESS THAN 18 YEARS OLD.
NO TAX IF YOU ARE THE PRESIDENT OF THE COMPANY
No tax if you get paid less than 10,000
5% tax if you get paid between 10K and 20K
10% tax if you get paid more than 20K
Finally return this tax value. Then print the returned value in the function call.
# create function
def calculate_tax(age, salary, current_job_designation):
if age < 18:
return 0
if current_job_designation == 'PRESIDENT OF THE COMPANY':
return 0
if salary < 10000:
return 0
if 10000 <= salary <= 20000:
return salary * 0.05
else:
return salary * 0.1
# call function
tax = calculate_tax(25, 15000, 'teacher')
print(f'Your tax: {tax}.')
Comments
Leave a comment