Skip to content

Instantly share code, notes, and snippets.

@mattseymour
Created March 16, 2016 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattseymour/a14b93f33454db1c8a30 to your computer and use it in GitHub Desktop.
Save mattseymour/a14b93f33454db1c8a30 to your computer and use it in GitHub Desktop.
A small script to calculate energy costs per year
# Cost per units and standard day charge
ELEC_PKWH = 12.2
ELEC_DAILY = 11.420
GAS_PKWH = 2.973
GAS_DAILY = 12.910
# Number of units i use
ELEC_USAGE = 4000
GAS_USAGE = 8000
def standing_charge(ppd):
return (ppd*365) / 100
def cost_for_x_units(units, ppkwh):
return (units * ppkwh) / 100
if __name__ == '__main__':
elec_sc = standing_charge(ELEC_DAILY)
gas_sc = standing_charge(GAS_DAILY)
elec_kwh = cost_for_x_units(ELEC_PKWH, ELEC_USAGE)
gas_kwh = cost_for_x_units(GAS_PKWH, GAS_USAGE)
print 'Gas: --------------------'
print 'Standing charge:', gas_sc
print 'PKW hour', gas_kwh
print 'Yearly total:', gas_kwh + gas_sc
print 'Elec: -------------------'
print 'Standing charge:', elec_sc
print 'PKW hour', elec_kwh
print 'Yearly total:', elec_kwh + elec_sc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment