#!/usr/bin/python3
import sys

# Program: milesPerGallon01.py
# Objective: Calculate the milage for a vehicle using the fill-up data.
# Revisions
#           None
# Edward Bigos


try:
    miles = float(input("Enter a number of miles traveled: "))
except ValueError as error:
    print("Error: ",error)
    print("You have entered an invalid value. The input must be a number.")
    sys.exit(-1)

try:
    gallons = float(input("Enter the number of gallons on the last fill-up: "))
except ValueError as error:
    print("Error: ",error)
    print("You have entered an invalid value. The input must be a number.")
    sys.exit(-1)

try:
    milesPerGallon = miles/gallons
except ZeroDivisionError as error:
    print("Error: ", error)
    print("The number of gallons must be greater than zero.")
    sys.exit(-2)

print(f"The miles per gallon is {milesPerGallon:.1f}")