Assignment Overview
In this assignment, you will build a Personal Finance Calculator - a practical Python program that helps users manage their money. This project will test your understanding of all the fundamentals covered in Module 1: variables, data types, operators, comments, indentation, and input/output.
Variables (1.3)
Creating, naming, and modifying variables to store user data
Operators (1.3)
Arithmetic operators for calculations, comparison for decisions
Input/Output (1.3)
Getting user input with input() and displaying results with print()
The Scenario
Personal Finance Calculator
Your friend has just started their first job and asked you to create a simple Python program to help them manage their finances. They want to:
"I need a program where I can enter my monthly income and expenses, and it tells me how much I can save. Can you also show me if I am spending too much compared to what I earn? Keep it simple - I am just starting out!"
Your Task
Create a Python file called finance_calculator.py that implements a
Personal Finance Calculator. Your program should be interactive, asking the user
for their financial information and providing helpful insights.
Requirements
Your finance_calculator.py must implement ALL of the following features.
Read each requirement carefully and make sure your program meets all criteria.
Welcome Message and User Info
Your program should start by:
- Displaying a welcome message with the program name
- Asking for the user's name and storing it in a variable
- Greeting the user by name
# Example output:
# ================================
# Personal Finance Calculator
# ================================
# What is your name? Alice
# Hello, Alice! Let's manage your finances.
Collect Income Information
Ask the user for their monthly income:
- Prompt for monthly salary/income
- Convert the input to a number (float) for calculations
- Store in a descriptive variable name (e.g.,
monthly_income)
# Example:
# Enter your monthly income: 50000
Collect Expense Information
Ask the user for their monthly expenses in these categories:
- Rent/Housing - Monthly rent or housing costs
- Food - Groceries and dining out
- Transportation - Fuel, public transport, etc.
- Utilities - Electricity, water, internet, phone
- Entertainment - Movies, subscriptions, hobbies
Each expense should be stored in its own variable with a descriptive name.
Calculate Totals
Perform the following calculations:
- Total Expenses: Sum of all expense categories
- Monthly Savings: Income minus total expenses
- Savings Percentage: (Savings / Income) * 100
- Expense Percentage: (Total Expenses / Income) * 100
# Calculation examples:
total_expenses = rent + food + transport + utilities + entertainment
monthly_savings = monthly_income - total_expenses
savings_percent = (monthly_savings / monthly_income) * 100
Display Financial Summary
Show a formatted summary using f-strings:
- Display each expense category with its amount
- Show total expenses and monthly savings
- Display percentages with 1 or 2 decimal places
- Use separators (like dashes) to make it readable
# Example output format:
# ========== Financial Summary for Alice ==========
# Monthly Income: Rs. 50000.00
# --------------------------------------------------
# Expenses Breakdown:
# Rent/Housing: Rs. 15000.00
# Food: Rs. 8000.00
# Transportation: Rs. 3000.00
# Utilities: Rs. 2500.00
# Entertainment: Rs. 4000.00
# --------------------------------------------------
# Total Expenses: Rs. 32500.00
# Monthly Savings: Rs. 17500.00
# --------------------------------------------------
# You are saving 35.0% of your income!
Provide Financial Feedback
Based on the savings percentage, display a message:
- If savings >= 30%: "Excellent! You are a great saver!"
- If savings >= 20%: "Good job! You have healthy saving habits."
- If savings >= 10%: "Not bad, but try to save a bit more."
- If savings >= 0%: "Warning: You are barely saving. Review your expenses."
- If savings < 0%: "Alert! You are spending more than you earn!"
# Use if/elif/else for this logic
if savings_percent >= 30:
print("Excellent! You are a great saver!")
elif savings_percent >= 20:
# ... and so on
Code Quality Requirements
Your code must follow these standards:
- Comments: Add a header comment with your name, date, and program description
- Comments: Add comments explaining each section of your code
- Variables: Use descriptive snake_case variable names
- Indentation: Use 4 spaces for all indented blocks
- Blank lines: Separate logical sections with blank lines
# ================================
# Personal Finance Calculator
# Author: Your Name
# Date: January 2026
# Description: A program to help manage personal finances
# ================================
# --- Get User Information ---
name = input("What is your name? ")
# --- Collect Income ---
# Ask user for monthly income and convert to float
monthly_income = float(input("Enter your monthly income: "))
Example Run
Here is what a complete run of your program should look like:
================================
Personal Finance Calculator
================================
What is your name? Rahul
Hello, Rahul! Let's manage your finances.
--- Enter Your Income ---
Enter your monthly income: 60000
--- Enter Your Expenses ---
Enter rent/housing cost: 18000
Enter food expenses: 10000
Enter transportation cost: 4000
Enter utilities (electric, water, phone): 3500
Enter entertainment expenses: 5000
========== Financial Summary for Rahul ==========
Monthly Income: Rs. 60000.00
--------------------------------------------------
Expenses Breakdown:
Rent/Housing: Rs. 18000.00
Food: Rs. 10000.00
Transportation: Rs. 4000.00
Utilities: Rs. 3500.00
Entertainment: Rs. 5000.00
--------------------------------------------------
Total Expenses: Rs. 40500.00
Monthly Savings: Rs. 19500.00
--------------------------------------------------
You are saving 32.5% of your income!
Excellent! You are a great saver!
Thank you for using the Personal Finance Calculator!
Submission
Create a public GitHub repository with the exact name shown below:
Required Repository Name
python-finance-calculator
Required Files
python-finance-calculator/
├── finance_calculator.py # Your main Python program
├── sample_output.txt # Copy of a sample run (copy from terminal)
└── README.md # REQUIRED - see contents below
README.md Must Include:
- Your full name and submission date
- Brief description of what your program does
- How to run the program (e.g.,
python finance_calculator.py) - Any challenges you faced while creating this program
Do Include
- All 7 requirements implemented
- Header comment with your name and date
- Comments explaining each section
- Descriptive variable names
- Proper indentation (4 spaces)
- A sample output file
Do Not Include
- Any external libraries or imports
- Code that does not run
- Hardcoded values (use input() for all data)
- Single letter variable names (like x, y, z)
- Missing comments or documentation
Enter your GitHub username - we will verify your repository automatically
Grading Rubric
Your assignment will be graded on the following criteria:
| Criteria | Points | Description |
|---|---|---|
| Variables & Data Types | 20 | Correct use of variables with descriptive names, proper type conversion for input |
| Input/Output | 20 | Proper use of input() to get data and print() with f-strings for formatted output |
| Operators & Calculations | 20 | Correct arithmetic operations for totals, savings, and percentages |
| Conditional Logic | 15 | Proper use of if/elif/else for financial feedback based on savings percentage |
| Code Quality | 15 | Comments, indentation, variable naming, and code organization |
| Documentation | 10 | README.md with all required sections, sample output file included |
| Total | 100 |
Ready to Submit?
Make sure you have completed all requirements and reviewed the grading rubric above.
Submit Your AssignmentWhat You Will Practice
Variables (1.3)
Creating variables with descriptive names, storing different types of data, and modifying values
Data Types (1.3)
Working with strings for names, floats for money, and converting between types with int() and float()
Operators (1.3)
Using +, -, *, / for calculations, and comparison operators for decision making
Input/Output (1.3)
Getting user input with input(), displaying results with print(), and formatting with f-strings
Pro Tips
Getting Started
- Start with the welcome message and name input
- Add one expense at a time and test
- Get the calculations working before formatting output
- Add the if/elif/else feedback last
Debugging Tips
- Use print() to check variable values while testing
- Test with simple numbers first (like 100, 50, 25)
- Check that you converted input to float for money
- Verify your percentage calculations are correct
Formatting Output
- Use f-strings:
f"Total: Rs. {amount:.2f}" - The
:.2fformats to 2 decimal places - Use
print("-" * 40)for separator lines - Add blank print() calls for spacing
Common Mistakes
- Forgetting to convert input() to float for money
- Using = instead of == in conditions
- Not using proper indentation (must be 4 spaces)
- Dividing by zero if income is 0