Skip to content

Instantly share code, notes, and snippets.

@radeinla
Last active June 7, 2017 09:59
Show Gist options
  • Save radeinla/b6402498b7aa1e32226fbb8cdd695e83 to your computer and use it in GitHub Desktop.
Save radeinla/b6402498b7aa1e32226fbb8cdd695e83 to your computer and use it in GitHub Desktop.
Cat Portions Calculator
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Getting Portions of Food For Cats"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"weight = 367.0"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"cats = 4"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"container_weight = 295.0"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[349.0, 331.0, 313.0, 295.0]\n"
]
}
],
"source": [
"print [weight - ((weight-container_weight)/4) * (i + 1) for i in xrange(0,cats)]"
]
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [Root]",
"language": "python",
"name": "Python [Root]"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.10"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment