Answer to Question #278871 in Python for Munif

Question #278871

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.


1
Expert's answer
2021-12-12T20:21:27-0500
# 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}.')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS