A1 - Python Basics Review
Reference for this assignment
Python Manual - Pages 2-5
The section on f-strings on page 7 may also be useful.
Learning Goals
- Use the
printfunction - Use the
inputfunction to get both string and numerical data from the user - Work with variables, along with mathematical operators and functions
- Use conditional statements that include:
if,elif,else,and,or
Suggested Task
Overview
Build a Python program that acts as a financial consultant. Your script will collect financial data from a user, perform calculations to determine their financial health, and provide a personalized report based on specific logical conditions.
Requirements
Your program must successfully implement the following:
-
Data Collection: Use
input()to ask for the user's Name (stored as a string).- Use
input()to ask for their Monthly Income, Rent/Mortgage, and Other Expenses (stored as floats).
- Use
-
Calculations:
-
Calculate Total Expenses.
-
Calculate Monthly Net Savings (Income minus Total Expenses).
-
Calculate the Savings Percentage (what percent of their income they are keeping).
-
-
Personal Feedback Message: Use
if,elif, andelseto provide feedback:-
"High Saver" if savings are 20% or more of income.
-
"Moderate Saver" if savings are between 1% and 19% of income. More specifically, it might be useful to interpret this as any percentage greater than zero but strictly less that 20.
-
"Over-spender" if total expenses are greater than income.
-
Sample Output
Your final terminal output should look professional and clear, similar to this:
--- FINANCIAL HEALTH REPORT FOR: [Name] ---
Monthly Income: $[Value]
Total Expenses: $[Value]
Monthly Savings: $[Value]
Result: [Personalized Feedback Message]
-------------------------------------------
Hints and Guidelines
- Ensure your variables are named descriptively (e.g.,
monthly_incomeinstead ofx). - Be sure to convert your input strings into numbers before performing math.
- Test your code with different values to make sure your
ifstatements trigger correctly!