Transportation CO₂ Emissions Calculator (Python Project)

Situation

This project was completed as an individual assignment for CSE 231. I wanted to create something simple that connects basic Python programming with an environmental topic. The idea came from noticing how different transportation choices affect CO₂ emissions and wanting to visualize that impact.

Task

My task was to create a small tool that estimates how much carbon dioxide is released when someone travels a certain distance. I needed to allow the user to choose a transportation mode (car, train, bus, or plane), enter distance, and receive a clear CO₂ emission estimate.

Action

To complete the task, I took the following steps:

  • Wrote a short Python script
  • Added user inputs for transportation type and distance
  • Used basic emission factors for each travel mode
  • Applied a simple formula to convert emissions from grams to kilograms
  • Organized the output so the result is clear and easy to read
  • Tested the program with several inputs to ensure it worked correctly

Code Example

print("Transportation CO₂ Emissions Calculator")

mode = input("Choose transport (car/train/bus/plane): ").lower()
distance = float(input("Enter distance in km: "))

if mode == "car":
    factor = 120
elif mode == "train":
    factor = 40
elif mode == "bus":
    factor = 80
elif mode == "plane":
    factor = 255
else:
    factor = 100

emissions_kg = (distance * factor) / 1000

print("\n--- CO₂ Emission Estimate ---")
print(f"Transport mode: {mode}")
print(f"Distance: {distance} km")
print(f"Estimated Emissions: {emissions_kg:.2f} kg CO₂")

Result

After completing the project, I gained a better understanding of how emission factors differ between transportation types. I also practiced basic Python input/output and conditional logic. The final result is a small but effective tool that visually demonstrates how travel decisions impact the environment. This project helped me think more about sustainability and allowed me to practice simple programming skills with a real-world concept.