I am trying to use an int input from the anual_salary function to calculate an answer for the fed_tax function but I keep getting an error saying the saved variable from function 1 is undefined in function 2.
I understand that salary is locally scoped but I need to use it in the next function along with other functions.
def anual_salary():
salary = int(input("Enter your salary: "))
print(f"Gross income is ${salary}")
print(" ")
return salary
def fed_tax():
esbi = input("Are you an Employee, Self Employed, Business owner, or Investor? ")
if esbi == "Employee" or "employee":
fed_income_tax = .37 * salary
elif esbi == "Self Employed" or "self employed":
fed_income_tax = .35 * salary
elif esbi == "Business owner" or "business owner":
fed_income_tax = .20 * salary
elif esbi == "Investor" or "investor":
fed_income_tax = .15 * salary
else:
print("Incorrect answer!")
fed_income_tax = round(fed_income_tax, 2)
print(f"Your Federal Income Tax is ${fed_income_tax}")
print(" ")
return fed_income_tax
What am I doing wrong?