These are my solutions for Harvard CS50’s Introduction to Programming with Python (CS50P), including problem sets, unit tests for selected problems, and a final project. Most programs are small, self-contained CLI scripts.
- Final project: Rock, Paper, Scissors & Sheldon’s Game (Big Bang Theory variant)
- Some folders include tests runnable with pytest
final/: Final project (two games). Run:python final/project.pybitcoin/: Fetches BTC price and multiplies by an amount. Run:python bitcoin/bitcoin.py 2figlet/: ASCII-art text rendering with selectable fonts. Run:python figlet/figlet.py -f slantemojize/: Converts aliases like ":smile:" to emoji. Run:python emojize/emojize.pyshirt/: Overlays a shirt image onto a photo using Pillow. Run:python shirt/shirt.py input.jpg output.jpgshirtificate/: Generates a CS50 “shirtificate” PDF. Run:python shirtificate/shirtificate.pypizza/: Pretty-prints a CSV as a table. Run:python pizza/pizza.py menu.csvscourgify/: Cleans a CSV of names into first/last columns. Run:python scourgify/scourgify.py before.csv after.csvseasons/: Prints minutes lived from a YYYY-MM-DD DOB in words. Run:python seasons/seasons.pyresponse/: Simple email validator. Run:python response/response.py- Many other folders (
adieu/,bank/,camel/,coke/,deep/,einstein/,extensions/,faces/,game/,grocery/,indoor/,interpreter/,jar/,lines/,meal/,nutrition/,outdated/,plates/,playback/,professor/,taqueria/,tip/,twttr/,um/,watch/,working/) contain one small CLI script each. Enter the folder and run the Python file inside.
- Ensure Python 3.10+ is installed
- (Recommended) Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate
python -m pip install -U pip- Install dependencies used across exercises
python -m pip install requests emoji pyfiglet Pillow fpdf2 inflect tabulate validator-collection pytest- From the repository root, run individual scripts by path, for example:
python bitcoin/bitcoin.py 2
python figlet/figlet.py -f slant
python shirt/shirt.py input.jpg output.jpg- Many scripts read from standard input; prompts will guide you. Press Ctrl+D (or Ctrl+C) to exit where noted.
Run all tests from the repository root:
pytest -qRun a specific test file (examples):
pytest final/test_project.py -q
pytest test_fuel/test_fuel.py -q
pytest test_twttr/test_twttr.py -q- Folder:
final/ - Run:
python final/project.py - Two modes:
- 1: Classic Rock–Paper–Scissors (first to 3 points)
- 2: Sheldon’s Game (Rock–Paper–Scissors–Lizard–Spock, first to 3 points)
- Exit anytime with Ctrl+D or Ctrl+C
- Tests:
pytest final/test_project.py -q - Demo video: YouTube
requests(used bybitcoin)emoji(used byemojize)pyfiglet(used byfiglet)Pillow(PIL; used byshirt)fpdf2(used byshirtificate)inflect(used byseasons,adieu)tabulate(used bypizza,scourgify)validator-collection(used byresponse)pytest(for tests)
Thanks to Harvard University, Prof. David J. Malan, and the CS50 staff for an excellent course.