Tuesday, July 29, 2008

Gas Sucks

So... Unless you've been living in a cave, you know that gas is expensive.

Where I currently live, gas is around $3.70-3.80USD/gal. And unless you've been living under a rock, you also know that people are trying to save money, by shopping at the cheapest gas stations. I haven't played with the figures before, so for your joy and education, I'll explain several figures and numbers.

First off, let's figure out some statistics. This fall I will be traveling at least 40 miles a day, 5 days a week. I may be doing more, so lets go with 240 miles a week. My car gets about 20 mpg.

Today, I purchased gas for $3.74, instead of $3.88 at the highest station I saw. According to my calculations, (assuming 240 gallons), I would have paid $44.99, rather than $46.67, coming to a savings of a whopping $1.68. I suppose I could have bought something at the dollar store or off a dollar menu at a fast food joint for that much.

On a yearly basis (52 weeks - though I don't drive 240 each week, so this won't even be accurate), that would mean I would save a total of $87.36. If I continually managed to save $.14/gallon. That is a fairly substantial annual savings, however usually the prices are less.

What does it look like if we average $.05 per gallon savings, for a whole year, at 240 miles? That's 60₵ per week, or $31.20 a year.

So we've been looking at a weekly average of 240 miles. What if you average less, say around 100 miles per week, with a 5₵ savings in gas. That's 25₵ per week, or $13 per year. Not as substantial, although for $13 you can almost go see a movie with two people. Once a year. With your gasoline savings.

So, in some cases it makes a lot of sense to find the cheapest gas, in others, it doesn't. If you'd like to experiment with your own data, this program allows you to change the gas prices, mpg, and miles driven. It then computes monthly and annual savings.

It's written in python, if you don't have python, you'll have to download it here.


1 # Wayne Werner
2 # Copyright July, 2008
3 # This code may be distributed and modified for personal or non-commercial
4 # use only.
5 # Gas Savings Calculator
6 # Used for calculating weekly, monthly, and yearly gas savings
8 from decimal import Decimal
9 from os import system
10 clear = system('clear') # Change 'clear' to 'cls' on a Windows machine
12 # Retrieves information from user, converting it to decimal type
13 gasA = Decimal(raw_input('Lower Gas Price: $'))
14 gasB = Decimal(raw_input('Higher Gas Price: $'))
15 mpg = Decimal(raw_input('Miles per gallon: '))
16 miles = Decimal(raw_input('Miles Traveled: '))
19 clear # Clears the screen
21 # Creates a list of miles, by 10, up to the miles traveled, to show
22 # what the savings would be for lesser miles traveled
23 24 my_range = range(10, miles, 10)
25 if my_range[-1] != miles:
26 my_range.append(int(miles))
28 # Prints column headers
29 print "%6s %7s %7s %11s\n" % \
30 ('Miles', 'Price A', 'Price B', 'Difference')
32 # Loops over the values in my_range, computing the total price for
33 # each price of gasoline.
34 for x in my_range:
35 if x == my_range[-1]: # Linebreak before the final values
36 print "\n",
37 priceA = (x/mpg) * gasA
38 priceB = (x/mpg) * gasB
39 diff = priceB - priceA
40 print "%6i $%6.2f $%6.2f $%4.2f" % (x, priceA, priceB, diff)
42 # Computes yearly and monthly savings, based on the difference
43 annual_savings = 52 * diff
44 monthly_savings = 4 * diff
45 print "\nAt an average weekly savings of $%.02f, your monthly savings will b
e $%.02f.\nYour annual savings will be $%.02f." \
46 % (diff, monthly_savings, annual_savings)

Labels: , , , , ,


Post a Comment

<< Home