Question 30: If Elif Else Budget Planner

Exercise: Enhanced Monthly Budget Planner

Objective:

Create a simple monthly budget planner that helps users track their income and expenses.

Steps:

  1. User Information:

    • Ask the user for their name and store it in a variable called name.
    • Ask the user for their total monthly income and store it in a variable called monthly_income.
  2. Monthly Expenses:

    • Ask the user for their monthly rent and store it in a variable called rent.
    • Ask the user for their monthly groceries expense and store it in a variable called groceries.
    • Ask the user for their monthly transportation cost and store it in a variable called transportation.
    • Ask the user for any other monthly expenses (e.g., entertainment) and store it in a variable called other_expenses.
  3. Calculate Total Expenses:

    • Create a variable to calculate the total monthly expenses by adding together rent, groceries, transportation, and other expenses.
  4. Calculate Remaining Balance:

    • Create a variable to calculate the remaining balance after subtracting total expenses from monthly income.
  5. Check Budget Status:

    • Use if-elif-else statements to evaluate the remaining balance and provide feedback:
      • If remaining_balance is greater than 500,
        [remaining_balance] left. Consider saving or investing some of it!”
      • If remaining_balance is between 0500,
        print: “Nice work, [name]! You have $[remaining_balance] left. This is a good amount for savings or leisure.”
      • If remaining_balance is less than 0,
        print: “Oops, [name]! You are over budget by $[abs(remaining_balance)]. Consider cutting back on expenses.”
Write what you are looking for, and press enter to begin your search!