#!/usr/bin/python3
import sys

# Program: milesPerGallon04.py
# Objective: Calculate the milage for a vehicle using the fill-up data.
# Revisions
#           Check for division by zero error
# Edward Bigos

fillupList = [[200,10],[400,19], [190,9.8],[290,18],[300,16]]

def calculateMilesPerGallon(miles,gallons):
    try:
        milesPerGallon = miles / gallons
    except ZeroDivisionError as error:
        print("Error: ", error)
        print("You have entered an invalid value for the gallons. The input must greater than zero.")
        sys.exit(-1)
    return milesPerGallon

def getFloatValue(message):
    try:
        fValue = float(input(message + ": "))
    except ValueError as error:
        print("Error: ", error)
        print("You have entered an invalid value. The input must be a number.")
        sys.exit(-1)
    return fValue

for fillup in fillupList:
#    print("This fillup data ",fillup)
    miles = fillup[0]
    gallons = fillup[1]

    milesPerGallon = calculateMilesPerGallon(miles,gallons)
    print(f"Miles = {miles}, Gallons = {gallons}")
    print(f"The miles per gallon is {milesPerGallon:.1f}\n")