Tutorial series
Learn to program from zero
Never programmed before? Build a budget tracker in Python one idea at a time: variables, input, decisions, loops, lists, functions, files and handling mistakes.
Write your first program: a budget tracker that prints a balance
You will write budget.py, a short Python 3.15 program that stores a monthly budget and two expenses in variables, works out what is left and prints it in your own currency, plus a plain-words plan for the rest of the tracker.
Beginner · 13 min
Record what you spend from the keyboard with input
You will change the budget tracker so it asks for your budget and an expense when it runs, turns the typed text into numbers and prints the right balance.
Beginner · 14 min
Warn when spending goes over budget with if and else
You will teach your Python budget tracker to make decisions, so it warns you when you overspend, cautions you when less than a tenth of the budget is left, and otherwise shows the balance.
Beginner · 14 min
Keep asking for expenses until the user is done
You will turn the budget tracker into a program that asks for expense after expense with a while loop, stops when you type done, and prints the total, how many expenses you entered and what is left.
Beginner · 14 min
Store each expense in a list and print a spending summary
You will change the budget tracker so it keeps every expense as a dictionary in a list, then prints a summary table with each expense, the biggest one and a total per category after you type done.
Beginner · 18 min
Organise the budget tracker into functions
You will split the fifty-line budget tracker into ask_for_expense, total_spent, total_by_category, print_summary and main, proving after every move that it still prints exactly the same summary.
Beginner · 22 min
Save expenses to a CSV file and load them next time
You will add save_expenses() and load_expenses() to the budget tracker so every expense is kept in expenses.csv between runs, the first run starts cleanly, and the file opens in any spreadsheet.
Beginner · 18 min
Handle bad input and finish the budget tracker
You will make the Python budget tracker survive bad typing with try and except, give blank categories a default, add a monthly report, test it with pytest and finish with a documented program of about 160 lines.
Beginner · 22 min