Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fare & Budget Check

Time-box: 45–60 minutes
Milestone: three pure functions calculate a rounded-up fare share, remaining money, and a budget label without reading input or changing outside state.

Companion learning path: Python From First Principles. If Python or Git is not ready yet, use the free installation guide.

Start your own copy

On GitHub, select Use this templateCreate a new repository, then clone your new repository and work in that copy. The starting red checks are intentional; your goal is to turn them green and complete the two human-review gates in MASTERY.md.

What you will practise

  • integer arithmetic for exact small-unit money;
  • parameters, returns, validation, and boundary branches;
  • reading a focused unittest failure;
  • keeping calculations separate from printed output.

Start here

From this directory, run:

python3 -B -I tests/run_tests.py

The untouched starter has exactly three intentional failures, all named test_todo_.... The validation tests should pass. Work only in fare_budget.py and replace each NotImplementedError with behaviour.

Use these contracts:

  • fare_share(fare_cents, riders) returns the whole-cent amount each rider should contribute, rounded up so the fare is covered;
  • money_left(income_cents, costs_cents) returns a negative value when costs exceed income;
  • budget_label(left_cents) returns "over budget", "balanced", or "within budget".

bool is a subclass of int in Python, but True is not a sensible money amount or rider count. Keep the supplied validation that rejects it.

Acceptance checks

  • fare_share(1_000, 3) is 334, and zero fare is supported.
  • A rider count must be a positive whole number.
  • Fare, income, and costs must be non-negative whole cents.
  • Remaining money may be negative.
  • All three label boundaries are correct.
  • The functions return values and never call input().
  • python3 -B -I tests/run_tests.py exits successfully.

Finish with MASTERY.md.

Get your automatic project grade

  1. Create your own copy from this template.

  2. Read MASTERY.md, then create an attempt branch:

    git switch -c attempt/my-project
  3. Build the project and run the same check GitHub uses:

    python3 -B -I tests/run_tests.py
  4. Commit and push the attempt branch:

    git add .
    git commit -m "Complete project attempt"
    git push -u origin attempt/my-project

GitHub Actions grades every pushed attempt automatically. PASS — NAILED IT means every required check passed. REVISE — KEEP BUILDING means the run shows what to fix before you push again. You do not need the KODE Ń VIBE owner to review or start anything; the template's main branch stays quiet on purpose.

The free grading guide explains the result and its limits.

About

Build and verify pure Python fare-sharing and budget functions.

Topics

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages