Skip to content

Instantly share code, notes, and snippets.

@easierbycode
Created May 29, 2015 04:07
Show Gist options
  • Save easierbycode/66f0e6ca2a1c2027eeb2 to your computer and use it in GitHub Desktop.
Save easierbycode/66f0e6ca2a1c2027eeb2 to your computer and use it in GitHub Desktop.
# A program to print a receipt after gas is pumped
# Import statements
import datetime
# Global variable declaration
numberOfGallons = 13.000
costPerGallon = 2.05
totalCost = numberOfGallons * costPerGallon
stationName = "Chevron"
stationLocation = "Peoria"
fuelType = "unleaded"
date = datetime.datetime.now().strftime("%m/%d/%y")
# Functions
# Classes
# Main program
# Display the station name and location
print("\n\n-= Thank you for shopping at {} ({}) =-").format(stationName, stationLocation)
# Date of the receipt is being issued/given
print(date)
# Type of Gas
print("Fuel type: {}").format(fuelType)
# The number of gallons, cost per gallon, and total cost
print("{:.3f} gallons x {:.2f} = ${:.2f}\n\n").format(numberOfGallons, costPerGallon, totalCost)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment