DEV Community

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

![Project Screenshot]!(https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l2u4hy9c4vfl8o2rwes0.png)

Screenshot from the Day 6 commit

Replace the above image URL with a real screenshot of your app output or code view!

Source: https://github.com/kinspire-cyber/30DaysOfPythonProjects/commit/2e21fa24771454628190ef711b633f9cc90f4039


🚀 What I Built — A Fixed Transport Route & Fare Reference System (Nigeria)

For Day 6 of the #30DaysOfPythonProjects challenge, I created a simple yet powerful Python script that stores immutable transport routes and fares using tuples. This helps commuters refer to fixed prices on common Nigerian routes — tackling the problem of arbitrary fare increases and lack of transparency.

🧠 Why This Matters

In cities like Lagos, Abuja, and Port Harcourt, public transport commuters often struggle with inconsistent fare pricing because:

  • Drivers change fares arbitrarily
  • Passengers lack any fixed reference
  • Everyday riders (students, civil servants, commuters) are affected

This system gives one source of truth for route pricing, making it easier to stay fair and informed.


🗺️ How It Works

The core idea is to use Python tuples, which are immutable — meaning they can’t be accidentally changed once defined. This is perfect for storing fixed route data that shouldn’t be modified casually.

📌 Key Concepts Used

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

Tuples help ensure the route and fare data stays fixed and consistent throughout the program. :contentReference[oaicite:0]{index=0}


🧱 Project Code (Simplified)

Here’s a core part of the implementation:


python
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))
Enter fullscreen mode Exit fullscreen mode

Top comments (0)