Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
951 B
1
Indexable
Never
# Define a list of categories
categories = ['Housing', 'Food', 'Transportation']

# Define a dictionary to store the user's budget information
budget = {}

# Initialize the budget for each category to 0
for category in categories:
  budget[category] = {'income': 0, 'expenses': 0}

# Prompt the user to input their budget information
for category in categories:
  income = input(f'Enter the income for {category}: ')
  expenses = input(f'Enter the expenses for {category}: ')
  budget[category]['income'] += income
  budget[category]['expenses'] += expenses

# Calculate the overall budget balance
balance = 0
for category in categories:
  balance += budget[category]['income'] - budget[category]['expenses']

# Display the budget balance and breakdown to the user
print(f'Your overall budget balance is: {balance}')
for category in categories:
  print(f'{category}: Income = {budget[category]['income']}, Expenses = {budget[category]['expenses']}')