Assignment 1-A

Python Basics Practice

Put your Python fundamentals to the test! Build a Personal Finance Calculator that uses variables, data types, operators, user input/output, and proper code organization to solve real-world problems.

2-3 hours
Beginner
100 Points
Submit Assignment
What You'll Practice
  • Create and use variables correctly
  • Work with different data types
  • Apply arithmetic and comparison operators
  • Get user input and display output
  • Write clean, well-commented code
Contents
01

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.

Beginner Friendly: This is your first assignment! Take your time, refer back to the lessons if needed, and focus on writing clean, working code. Do not worry about advanced features - master the basics first!
Skills Applied: This assignment tests your understanding of Introduction to Python (1.1), Setting Up Python (1.2), and Basic Syntax (1.3) from Module 1.
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()

Ready to submit? Already completed the assignment? Submit your work now!
Submit Now
02

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.

Tip: Before you start coding, plan out what variables you need, what calculations to perform, and what output to display. A little planning goes a long way!
03

Requirements

Your finance_calculator.py must implement ALL of the following features. Read each requirement carefully and make sure your program meets all criteria.

1
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.
2
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
3
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.

4
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
5
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!
6
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
7
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: "))
04

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!
Note: Your output does not need to match this exactly, but it should include all the required information in a clear, readable format.
05

Submission

Create a public GitHub repository with the exact name shown below:

Required Repository Name
python-finance-calculator
github.com/<your-username>/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
Important: Before submitting, run your program multiple times with different inputs to make sure it works correctly!
Submit Your Assignment

Enter your GitHub username - we will verify your repository automatically

06

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 Assignment
07

What 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

08

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 :.2f formats 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
09

Pre-Submission Checklist

Code Requirements
Repository Requirements