Skip to content

Instantly share code, notes, and snippets.

@endlesspint8
Last active September 23, 2016 13:03
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 endlesspint8/0046fb81ae6085e83d5c868a64121ca5 to your computer and use it in GitHub Desktop.
Save endlesspint8/0046fb81ae6085e83d5c868a64121ca5 to your computer and use it in GitHub Desktop.
def craft_import_match(year, overall, overall_growth, craft, craft_growth, imp, imp_growth):
print "starting metrics:"
print "year:", year
print "overall %d BBLS and %3.3f percent growth" % (overall, overall_growth)
print "craft %d BBLS & %2.3f percent growth" % (craft, craft_growth)
print "import %d BBLS & %2.3f percent growth" % (imp, imp_growth)
print "\nyear\toverall_bbl\tcraft_bbl\timport_bbl"
while craft < imp:
year += 1
overall += overall * overall_growth
craft += craft * craft_growth
imp += imp * imp_growth
print year, overall, craft, imp
craft_import_match(2015, 196701792, -0.02, 24076864, 0.128, 31245124, 0.062)
# starting metrics:
# year: 2015
# overall 196701792 BBLS and -0.020 percent growth
# craft 24076864 BBLS & 0.128 percent growth
# import 31245124 BBLS & 0.062 percent growth
# year overall_bbl craft_bbl import_bbl
# 2016 192767756.16 27158702.592 33182321.688
# 2017 188912401.037 30635016.5238 35239625.6327
# 2018 185134153.016 34556298.6388 37424482.4219
# 2019 181431469.956 38979504.8646 39744800.332
# 2020 177802840.557 43968881.4873 42208977.9526
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment