text: # Function to get income input from the user
  def get_income():
     global income
     income = input("Enter your income: ")
     return income
  
  
  # Function to get expenses input from the user
  def get_expenses(categories):
     global amount
     global expenses
     expenses = []
     total = 0
     while total < int(income):
      category = input("Enter the expense category (press 'q' to quit): ")
      if category == "q":
          break
      else:
          categories.append(str(category))
          print("added new category")
          amount = input("Enter the expense amount: ")
          total += int(amount)
          expenses.append((category, amount))
          continue
     print("over budget")
     return expenses
  
  
  # Function to calculate total expenses from the expenses list
  def calculate_total_expenses():
     global total_expenses
     total_expenses = 0
     for expense in expenses:
      total_expenses += int(expense[1])
     return total_expenses
  
  
  # Function to calculate total savings based on income and expenses
  def calculate_total_savings(income, expenses):
     total_expenses = calculate_total_expenses(expenses)
     total_savings = int(income) - total_expenses
     return total_savings
  
  
  # Function to print the results to the console
  def print_results(income, expenses, total_savings):
     print("Income:", income)
     print("Expenses:")
     for expense in expenses:
      print(expense[0] + ":", expense[1])
     print("Total Expenses:", calculate_total_expenses(expenses))
     print("Total Savings:", total_savings)
  
  
  # Main function to run the program
  