Skip to content

Instantly share code, notes, and snippets.

Created March 16, 2016 15:29
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
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
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