Skip to content

Instantly share code, notes, and snippets.

@kwharrigan
Created November 4, 2014 17:49
Show Gist options
  • Save kwharrigan/46ffec4f96d96f439a58 to your computer and use it in GitHub Desktop.
Save kwharrigan/46ffec4f96d96f439a58 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "",
"signature": "sha256:ea8b3c66dea6efe478d6208cefc487d8ff9714a4d2bada7362112a3c3e9f16a4"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This is a comparison of Consumer Choice HSA and Comprehensive Care"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"def cost(amount,months=12,premium=132,deductable=3000,maximum=3000,rate=0.15):\n",
" t = months\n",
" p = premium\n",
" d = deductable\n",
" m = maximum\n",
" r = rate\n",
" base = t * p\n",
" if a < d:\n",
" c = a\n",
" else:\n",
" c = d + (a - d)*r \n",
" c = min(c,m)\n",
" return base + c\n",
"\n",
"def hsa(a):\n",
" return cost(a,months=12,\n",
" premium = 176,\n",
" deductable = 3000,\n",
" maximum = 7000,\n",
" rate = 0.20)\n",
"\n",
"def regular(a):\n",
" return cost(a,months=12,\n",
" premium = 492,\n",
" deductable = 1500,\n",
" maximum = 2500,\n",
" rate = 0.10)\n",
" \n",
"\n",
"pt=\"%9s\\t%9s\\t%9s\\t%9s\\t%9s\"\n",
"p=\"$%9.2f\\t$%9.2f\\t$%9.2f\\t$%9.2f\\t$%9.2f\"\n",
"print pt%(\"expenses\",\"HSA\",\"POS\",\"HSA savings\",\"HSA savings + card\")\n",
"for a in range (0,25000,1000):\n",
" print p%(a,hsa(a),regular(a),regular(a)-hsa(a),regular(a)-hsa(a)+750)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
" expenses\t HSA\t POS\tHSA savings\tHSA savings + card\n",
"$ 0.00\t$ 2112.00\t$ 5904.00\t$ 3792.00\t$ 4542.00\n",
"$ 1000.00\t$ 3112.00\t$ 6904.00\t$ 3792.00\t$ 4542.00\n",
"$ 2000.00\t$ 4112.00\t$ 7454.00\t$ 3342.00\t$ 4092.00\n",
"$ 3000.00\t$ 5112.00\t$ 7554.00\t$ 2442.00\t$ 3192.00\n",
"$ 4000.00\t$ 5312.00\t$ 7654.00\t$ 2342.00\t$ 3092.00\n",
"$ 5000.00\t$ 5512.00\t$ 7754.00\t$ 2242.00\t$ 2992.00\n",
"$ 6000.00\t$ 5712.00\t$ 7854.00\t$ 2142.00\t$ 2892.00\n",
"$ 7000.00\t$ 5912.00\t$ 7954.00\t$ 2042.00\t$ 2792.00\n",
"$ 8000.00\t$ 6112.00\t$ 8054.00\t$ 1942.00\t$ 2692.00\n",
"$ 9000.00\t$ 6312.00\t$ 8154.00\t$ 1842.00\t$ 2592.00\n",
"$ 10000.00\t$ 6512.00\t$ 8254.00\t$ 1742.00\t$ 2492.00\n",
"$ 11000.00\t$ 6712.00\t$ 8354.00\t$ 1642.00\t$ 2392.00\n",
"$ 12000.00\t$ 6912.00\t$ 8404.00\t$ 1492.00\t$ 2242.00\n",
"$ 13000.00\t$ 7112.00\t$ 8404.00\t$ 1292.00\t$ 2042.00\n",
"$ 14000.00\t$ 7312.00\t$ 8404.00\t$ 1092.00\t$ 1842.00\n",
"$ 15000.00\t$ 7512.00\t$ 8404.00\t$ 892.00\t$ 1642.00\n",
"$ 16000.00\t$ 7712.00\t$ 8404.00\t$ 692.00\t$ 1442.00\n",
"$ 17000.00\t$ 7912.00\t$ 8404.00\t$ 492.00\t$ 1242.00\n",
"$ 18000.00\t$ 8112.00\t$ 8404.00\t$ 292.00\t$ 1042.00\n",
"$ 19000.00\t$ 8312.00\t$ 8404.00\t$ 92.00\t$ 842.00\n",
"$ 20000.00\t$ 8512.00\t$ 8404.00\t$ -108.00\t$ 642.00\n",
"$ 21000.00\t$ 8712.00\t$ 8404.00\t$ -308.00\t$ 442.00\n",
"$ 22000.00\t$ 8912.00\t$ 8404.00\t$ -508.00\t$ 242.00\n",
"$ 23000.00\t$ 9112.00\t$ 8404.00\t$ -708.00\t$ 42.00\n",
"$ 24000.00\t$ 9112.00\t$ 8404.00\t$ -708.00\t$ 42.00\n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 15
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment