Day 6 – Build a Fixed Transport Route & Fare Reference System in Python

Published: (January 8, 2026 at 11:04 PM EST)
1 min read
Source: Dev.to

Source: Dev.to

Project Screenshot
Screenshot from the Day 6 commit

Overview

For Day 6 of the #30DaysOfPythonProjects challenge, a simple Python script was created to store immutable transport routes and fares using tuples. The script provides commuters with a fixed reference for common Nigerian routes, addressing arbitrary fare increases and a lack of pricing transparency.

Problem Statement

In cities such as Lagos, Abuja, and Port Harcourt, public‑transport commuters often face inconsistent fare pricing because:

  • Drivers change fares arbitrarily.
  • Passengers have no fixed reference.
  • Everyday riders (students, civil servants, commuters) are affected.

Solution

The system offers a single source of truth for route pricing, making fare information fair and easily accessible. By using tuples, which are immutable, the route and fare data cannot be altered unintentionally, ensuring consistency throughout the program.

Key Concepts

  • Tuples
  • Tuple indexing
  • Nested tuples
  • Tuple unpacking
  • len() function
  • Clean formatted printing

These concepts help keep the route and fare data fixed and consistent.

Implementation

routes = (
    ("Ojota", "Yaba", 500),
    ("CMS", "Lekki", 700),
    ("Wuse", "Garki", 300),
    ("Airport", "Ikeja", 1500)
)

print("\nAVAILABLE TRANSPORT ROUTES")
print("---------------------------")

for route in routes:
    start, end, fare = route
    print(f"{start}{end} : ₦{fare}")

print("\nTotal Routes Available:", len(routes))
Back to Blog

Related posts

Read more »