Python Beginner Project: Black Friday Price Tracker
Sale weeks are full of "was" prices that were never real. This beginner project uses about 20 lines of Python to keep a price diary for the things you want, tell you when a price falls below your target, and flag a "sale" price that is actually higher than usual. It uses only what you learn in the first weeks of Python: files, lists, dictionaries, loops and if statements.
What you will build
- A
prices.csvfile where you note a price whenever you check a product. - A script that shows the latest price, the usual price and a warning when the "deal" is not a deal.
- A target price per product, so the script tells you when to buy.
Step 1: keep a price diary
Make a file called prices.csv and add a line each time you check a price. Type the prices in yourself from the shop's page or app. Many shops do not allow automated copying of their pages, so this project does not do that.
date,item,shop,price
2026-11-01,Headphones,Shop A,99.00
2026-11-10,Headphones,Shop A,95.00
2026-11-20,Headphones,Shop A,109.00
2026-11-27,Headphones,Shop A,89.00
2026-11-27,Air fryer,Shop B,64.00
Step 2: the script
Save this as tracker.py in the same folder and run python tracker.py. It reads every line, groups prices by product, and compares the newest price with the usual (median) price before it.
import csv
from statistics import median
TARGET = {"Headphones": 90.0, "Air fryer": 60.0} # the most you want to pay
prices = {}
with open("prices.csv", newline="") as f:
for row in csv.DictReader(f):
prices.setdefault(row["item"], []).append((row["date"], row["shop"], float(row["price"])))
for item, rows in prices.items():
rows.sort() # dates like 2026-11-27 sort correctly as text
date, shop, now = rows[-1]
before = [p for _, _, p in rows[:-1]]
usual = median(before) if before else now
print(f"{item}: {now:.2f} at {shop} on {date} (usual {usual:.2f})")
if item in TARGET and now <= TARGET[item]:
print(" below your target price")
if now > usual:
print(" this price is higher than usual: not a real deal")
Step 3: read the result
With the sample file, the headphones show 89.00 against a usual price of 99.00 and are below the 90.00 target, so the script says so. The air fryer has only one price recorded, so there is nothing to compare yet. Add a few more checks over the week and run it again.
Make it your own
- Add a column for the "was" price the shop shows, and print how far it is from the usual price you recorded.
- Write the results to a new CSV so you can open them in a spreadsheet.
- Turn the comparison into a function and test it with made-up numbers.
- If a shop offers an official API or price-alert feature, read its terms first, then try that instead of typing prices.
What this project teaches
Reading files, dictionaries of lists, sorting, a little statistics and clear output. These are the same skills used to clean real data at work, and the same habit of checking a number against its history keeps you safe from fake discounts.
Free course: Python in 60 Days
60 days, 3 parts, 12 chapters with quizzes. Go from zero to automating real work with Python.
Start free →Frequently asked questions
Is this project good for complete beginners?
Yes, after the first two or three weeks of Python. If a line looks new, the Python in 60 Days course covers files, dictionaries and loops step by step.
Why not download prices from shops automatically?
Many shops forbid automated copying of their pages in their terms, and their pages change often. Typing prices yourself keeps the project legal and simple. Use an official API only if the shop offers one and its terms allow it.
Do I need to install anything?
Only Python 3. The csv and statistics modules come with Python. You can also run it in an in-browser Python tool.