COMPUTER PROGRAMMING 1 (PYTHON) โ€ข PROBLEM SOLVING & MINI-PROJECTS

Packaging Console Apps โ€” I can package a console app with clear instructions, sample runs, and documented assumptions.

Learn how to deliver your Python programs so anyone can run them confidently.

Historical Context & Motivation

Have you ever sent a friend a Python file only to hear back, "It doesn't work on my computer"? You are not alone. Since the earliest days of programming, developers have struggled with the problem of software distribution โ€” getting code from the developer's machine into someone else's hands in a way that actually runs. The challenge is older than Python itself, stretching back to the era of punch cards and floppy disks.

In the early days, programs were tied to specific hardware. As personal computers became widespread in the 1980s and 1990s, developers began bundling their code with README files โ€” simple text documents that explained how to install and run the software. This humble practice became the backbone of open-source culture and is still considered essential today.

1970s
README is Born
Early Unix programmers start including a file called README with their tapes and disks, asking users to read it before doing anything else.
1991
Python 0.9 Released
Guido van Rossum releases Python with a philosophy of readability and simplicity, making it ideal for shareable scripts.
2004
setuptools & PyPI
The Python Package Index (PyPI) and setuptools give developers a standard way to distribute Python libraries and applications.
2008
GitHub Launches
GitHub popularizes hosting code with built-in README rendering, making clear documentation a social norm for developers worldwide.
2020s
Modern Packaging Tools
Tools like PyInstaller and zipapp let you freeze Python apps into single executables, while README conventions continue to mature.

The core question has not changed in fifty years: How do I hand my program to someone else and make sure it works? This lesson answers that question for your Python console apps by teaching you to write clear instructions, provide sample runs, and document every assumption your code makes.

Core Principles of Packaging

Packaging a console app is not just about zipping up your code. It means creating a complete, self-explanatory bundle that a stranger โ€” or future-you โ€” can understand without any extra help. Think of it like handing someone a board game: if the box is missing the rules, the pieces are unlabeled, and there is no picture of the finished game, nobody is going to have fun. A well-packaged app includes all the equivalent pieces.

1

Clear Instructions (README)

A README file tells the user what the program does, how to install dependencies, and how to run it. It should be readable in under two minutes.
2

Sample Runs

Copy-paste examples of actual input and output show users exactly what to expect. They serve as proof that the program works.
3

Documented Assumptions

Every program assumes something โ€” Python version, operating system, valid input range. Spelling these out prevents mysterious errors.
4

Organized File Structure

Group your source code, README, and any data files into a single folder with logical names. A messy project folder is a red flag.
5

Version & Authorship

Include your name, the date, and a version number. This helps users know if they have the latest copy and whom to contact for help.
โœฆ KEY TAKEAWAY
Think of packaging like writing a recipe card. The code is the ingredients, the README is the step-by-step directions, the sample runs are the photo of the finished dish, and the documented assumptions are the dietary notes ("contains nuts"). Without all four, someone trying your recipe will get lost.

Anatomy of a Packaged Console App

The diagram below shows a typical project folder for a well-packaged Python console app. Notice how every file has a clear purpose and the folder is named with the project title. This structure is what you should aim for whenever you hand off a project.

A minimal but complete project folder. The README.txt sits at the top because it is the first thing a user should open. The source code, sample run, assumptions, and requirements are each in their own clearly-named file.

Some teachers or projects may ask you to combine the README, sample run, and assumptions into a single README file. That is perfectly fine โ€” the key is that all three categories of information are present. For larger projects, separating them keeps each file short and easy to update.

How to Write Each Piece

The README: Your Project's Front Door

A good README answers five questions in this order: (1) What does this program do? (2) What do I need to have installed? (3) How do I run it? (4) What does a typical session look like? (5) What should I watch out for? You can use plain .txt format or Markdown (.md). Here is a template:

๐Ÿ“ README Template
=== My Calculator === Author: Jane Doe Date: January 2025 Version: 1.0 --- What It Does --- A simple command-line calculator that performs addition, subtraction, multiplication, and division on two numbers entered by the user. --- Requirements --- Python 3.8 or newer (no extra libraries needed) --- How to Run --- 1. Open a terminal / command prompt. 2. Navigate to this folder: cd my_calculator 3. Run: python calculator.py 4. Follow the on-screen prompts. --- Sample Run --- > python calculator.py Enter first number: 10 Enter second number: 3 Choose operation (+, -, *, /): / Result: 3.3333 --- Assumptions --- - User enters valid numbers (no letters). - Division by zero will display an error message. - Tested on Windows 11 and macOS Ventura.

Sample Runs: Show, Don't Tell

A sample run is a copy-paste of an actual terminal session. It includes the command you typed, every prompt the program printed, the user's input, and the final output. Include at least two sample runs: one that shows normal, expected behavior and one that shows edge-case or error handling. This proves to the reader that your program handles more than just the happy path.

Documented Assumptions: What You Took for Granted

Every program makes assumptions. Maybe you assumed the user would type a number, not a word. Maybe you assumed the file data.csv lives in the same folder. Maybe your code only works on Python 3.10 because you used match statements. Writing these down is not admitting weakness; it is a sign of professional maturity. Real software teams document assumptions in every design document they write.

  • Python version โ€” e.g., "Requires Python 3.8+"
  • Operating system โ€” e.g., "Tested on Windows 11 and macOS Sonoma"
  • Input format โ€” e.g., "User enters integers only, no decimals"
  • External files โ€” e.g., "scores.txt must exist in the same directory"
  • Known limitations โ€” e.g., "Does not handle negative numbers"

The Packaging Checklist

Before you submit or share your project, walk through the checklist below. Think of it as a quality-control inspection. Each item maps to one of the five core principles you learned in Section 2. The diagram that follows visualizes the flow from writing code to delivering a finished package.

The seven-step packaging workflow. Steps 1โ€“3 produce the raw materials. Steps 4โ€“6 organize them into a professional package. Step 7 is delivery โ€” usually a .zip file or a repository link.
Seven-item packaging checklist
โœ“Checklist ItemWhere to Put It
1Program description (1โ€“2 sentences)README โ€” top
2Author name, date, versionREADME โ€” header
3Installation/setup instructionsREADME โ€” Requirements
4Run command (e.g., python app.py)README โ€” How to Run
5At least 2 sample runs (normal + edge case)README or sample_run.txt
6All assumptions listedREADME or assumptions.txt
7Folder named, files named meaningfullyProject folder

Worked Example: Packaging a Tip Calculator

Let's walk through the entire process for a small project โ€” a tip calculator that asks for a bill amount and tip percentage, then prints the tip and total. We will write the code, test it, create sample runs, write the README, and document assumptions.

Packaging a Tip Calculator
1
Step 1 โ€” Write the CodeCreate a file called tip_calculator.py with the following content: # tip_calculator.py # Author: Alex Rivera # Date: January 2025 # Version: 1.0 bill = float(input("Enter the bill amount: $")) percent = float(input("Enter tip percentage (e.g., 20): ")) tip = bill * (percent / 100) total = bill + tip print(f"Tip: ${tip:.2f}") print(f"Total: ${total:.2f}")
File created: tip_calculator.py
2
Step 2 โ€” Run and TestOpen a terminal, navigate to the folder, and run python tip_calculator.py. Try several inputs: a normal bill ($50, 20%), a zero tip ($30, 0%), and a large tip ($100, 50%). Also try typing a word instead of a number to see what happens (spoiler: the program crashes with a ValueError โ€” that is an assumption to document).
Tested with 4 different input sets.
3
Step 3 โ€” Capture Sample RunsCopy-paste two terminal sessions into a section of your README. Here is the normal run: > python tip_calculator.py Enter the bill amount: $50 Enter tip percentage (e.g., 20): 20 Tip: $10.00 Total: $60.00 And here is the edge-case run with zero tip: > python tip_calculator.py Enter the bill amount: $30 Enter tip percentage (e.g., 20): 0 Tip: $0.00 Total: $30.00
Two sample runs captured: normal and edge case.
4
Step 4 โ€” Write the READMECreate README.txt using the template from Section 4. Fill in the project title, author, date, description, requirements (Python 3.6+, no libraries), run instructions, the sample runs from Step 3, and the assumptions from Step 5.
File created: README.txt
5
Step 5 โ€” Document AssumptionsList everything you assumed while coding. For this project: (a) The user enters valid numbers. (b) Negative bills or percentages are mathematically handled but don't make real-world sense. (c) Requires Python 3.6+ for f-strings. (d) Tested on Windows 11. (e) No input validation โ€” the program will crash if the user types non-numeric input.
Five assumptions documented in the README.
6
Step 6 โ€” Organize and DeliverPlace tip_calculator.py and README.txt into a folder named tip_calculator. Right-click the folder and choose "Compress" or "Send to โ†’ Compressed folder" to create tip_calculator.zip. Submit the zip file.
โœ… Package complete โ€” ready for submission!

Common Strengths & Pitfalls

When teachers and professional code reviewers evaluate a packaged console app, they look for specific strengths and watch for common mistakes. The table below contrasts what good packaging looks like versus what often goes wrong.

Strengths versus pitfalls in console app packaging
Areaโœ… Strong PackagingโŒ Common Pitfall
READMEAnswers all 5 questions; a stranger can run the app in under 2 minutesMissing or says only "Run my code" with no details
Sample RunsIncludes 2+ runs showing normal and edge-case behaviorNo sample run, or only one run with ideal input
AssumptionsLists Python version, OS, input constraints, and known limitationsNot mentioned at all; user discovers limits by crashing the program
File NamesDescriptive names like grade_book.py, README.txtFiles named untitled.py, test123.py, or final_FINAL_v3.py
FolderEverything in one clearly-named folder; no stray filesCode emailed as a loose attachment; no README at all
โœฆ KEY TAKEAWAY
Imagine downloading an app from the internet with zero instructions. You would probably delete it immediately. Your classmates and teachers feel the same way when they receive a project folder with no README. Good packaging is an act of respect for the person on the other end.

Connection to Professional Practices

The skills you are learning here are a simplified version of what professional developers do every day. In industry, packaging grows more complex โ€” but the principles stay the same. The table below compares what you are doing now with what you might encounter in a college course or a job.

Beginner versus professional packaging approaches
This CourseProfessional / Advanced
README.txt with run instructionsREADME.md with Markdown formatting, badges, and auto-generated docs
Copy-pasted sample runsAutomated test suites (pytest, unittest) that verify output programmatically
Manually listed assumptionsType hints, docstrings, and input validation built into the code
Zip file submissionGitHub repo, PyPI package, Docker container, or compiled executable
requirements.txt (if any)Virtual environments (venv), poetry, or conda environment files

Do not be intimidated by the professional column. Every expert started exactly where you are: writing a README in a text file and zipping up a folder. The habits you build now โ€” clear communication, honest documentation, and organized delivery โ€” will scale naturally as your projects grow.

๐Ÿš€ Looking Ahead
If you want to explore further, look into PyInstaller (turns a Python script into a standalone .exe), GitHub Pages (host your README as a website), or Markdown (a simple formatting language that makes your README look polished).

Practice Problems

PROBLEM 1 โ€” CONCEPTUAL
A classmate sends you a Python file called project.py with no other files or explanation. List three specific things you do not know that a good README would have told you.
PROBLEM 2 โ€” BASIC CALCULATION
You wrote a program that converts Fahrenheit to Celsius using the formula C = (F โˆ’ 32) ร— 5 / 9. Write a sample run for the input 212ยฐF and another for 32ยฐF. Show the exact text the user would see in the terminal.
PROBLEM 3 โ€” INTERMEDIATE
Below is a short Python program. Identify at least four assumptions it makes that should be documented. name = input("Enter student name: ") score = int(input("Enter test score: ")) if score >= 60: print(f"{name} passed!") else: print(f"{name} did not pass.")
PROBLEM 4 โ€” APPLIED
You built a grade-book program that reads a file called grades.csv and prints each student's average. Write a complete README for this program. Include: title/author/date, description, requirements, run instructions, one sample run, and at least three assumptions.
PROBLEM 5 โ€” CRITICAL THINKING
A teammate argues that writing a README is a waste of time because "the code speaks for itself." Write a three-to-four-sentence argument explaining why documented packaging matters, even when the code is well-written. Use at least one real-world analogy in your response.

Lesson Summary

Packaging a console app means delivering more than just a Python source file. A complete package includes a README that answers five essential questions (what, prerequisites, how to run, sample output, and caveats), at least two sample runs showing both normal and edge-case behavior, and a thorough list of documented assumptions covering Python version, operating system, input constraints, and known limitations.

The seven-step packaging workflow โ€” write code, test, capture runs, write the README, document assumptions, organize the folder, and deliver โ€” turns a loose script into a professional-quality deliverable. These habits mirror real-world software distribution practices and will serve you well in advanced courses, open-source contributions, and careers in technology. Remember: code that no one can run delivers zero value โ€” so package with care.

Varsity Tutors โ€ข Computer Programming 1 (Python) โ€ข Packaging Console Apps