Created
May 29, 2015 04:07
-
-
Save easierbycode/66f0e6ca2a1c2027eeb2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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