I'm new to functions, so I'm not quite sure how or why this is happening and I do not know how t fix it. Can someone explain why this error keeps occuring?
def loan_payment(l):
loan = float(input("Please enter how much you expend monthly on loan payments:"))
return loan
def insurance_cost(i):
insurance = float(input("Please enter how much you expend monthly on insurance:"))
return insurance
def gas_cost(g):
gas = float(input("Please enter how much you expend monthly on gas:"))
return gas
def maitanence_cost(m):
maitanence = float(input("Please enter how much you expend monthly on maintanence:"))
return maitanence
def monthly_cost(l, i, g, m):
monthly_expenses = float(l + i + g + m)
print("You expend $"+format(monthly_expenses, '.2f')+" in a month.")
return float(monthly_expenses)
def yearly_cost(monthly_cost):
yearly_expenses = 12 * monthly_cost
print("At your current monthly expenses, in a year you will have paid $"+format(yearly_expenses, '.2f')+".")
return yearly_expenses
def main():
loan_payment(l)
insurance_cost(i)
gas_cost(g)
maitanence_cost(m)
monthly_cost(l, i, g, m)
yearly_cost(monthly_cost)
main()
This code returns the error:
line 24, in main loan_payment(l) NameError: name 'l' is not defined