Skip to content

Instantly share code, notes, and snippets.

@bcolloran
Last active August 29, 2015 14:22
Show Gist options
  • Save bcolloran/3cefa7eaee5210da12ff to your computer and use it in GitHub Desktop.
Save bcolloran/3cefa7eaee5210da12ff to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"worksheets": [
{
"cells": [
{
"metadata": {},
"cell_type": "code",
"input": "date=\"2014-01-12\"",
"prompt_number": 3,
"outputs": [],
"language": "python",
"trusted": true,
"collapsed": false
},
{
"metadata": {},
"cell_type": "code",
"input": "(date[0:3]==\"201\"\n, date[3] in \"23456789\"\n, date[4]==\"-\"\n,date[5] in \"01\"\n,date[6] in \"0123456789\"\n,date[7]==\"-\"\n,date[8] in \"0123\"\n,date[9] in \"0123456789\")",
"prompt_number": 33,
"outputs": [
{
"output_type": "pyout",
"prompt_number": 33,
"metadata": {},
"text": "(True, True, True, True, True, True, True, True)"
}
],
"language": "python",
"trusted": true,
"collapsed": false
},
{
"metadata": {},
"cell_type": "code",
"input": "def isValidFhrDate(date):\n if (date[0:3]==\"201\"\n and date[3] in \"23456789\"\n and date[4]==\"-\"\n and date[5] in \"01\"\n and date[6] in \"0123456789\"\n and date[7]==\"-\"\n and date[8] in \"0123\"\n and date[9] in \"0123456789\"):\n return True\n else:\n return False",
"prompt_number": 39,
"outputs": [],
"language": "python",
"trusted": true,
"collapsed": false
},
{
"metadata": {},
"cell_type": "code",
"input": "map(isValidFhrDate,[\"2014-01-12\"])",
"prompt_number": 40,
"outputs": [
{
"output_type": "pyout",
"prompt_number": 40,
"metadata": {},
"text": "[True]"
}
],
"language": "python",
"trusted": true,
"collapsed": false
},
{
"metadata": {},
"cell_type": "code",
"input": "def allEqual(l):\n if len(l)<=1:\n return True\n else:\n e1 = l[0]\n for e in l[1:]:\n if e != e1:\n return False\n return True\n ",
"prompt_number": 50,
"outputs": [],
"language": "python",
"trusted": true,
"collapsed": false
},
{
"metadata": {},
"cell_type": "code",
"input": "allEqual([{\"foo\"+str(y):{\"foo\"+str(x):\"bat\"+str(y) for z in range(100)} for y in range(100)} for x in range(100)])",
"prompt_number": 63,
"outputs": [
{
"output_type": "pyout",
"prompt_number": 63,
"metadata": {},
"text": "False"
}
],
"language": "python",
"trusted": true,
"collapsed": false
},
{
"metadata": {},
"cell_type": "code",
"input": "1+1",
"prompt_number": 1,
"outputs": [
{
"output_type": "pyout",
"prompt_number": 1,
"metadata": {},
"text": "2"
}
],
"language": "python",
"trusted": true,
"collapsed": false
},
{
"metadata": {},
"cell_type": "code",
"input": "5*9",
"prompt_number": 1,
"outputs": [
{
"output_type": "pyout",
"prompt_number": 1,
"metadata": {},
"text": "45"
}
],
"language": "python",
"trusted": true,
"collapsed": false
},
{
"metadata": {},
"cell_type": "code",
"input": "89",
"prompt_number": 2,
"outputs": [
{
"output_type": "pyout",
"prompt_number": 2,
"metadata": {},
"text": "89"
}
],
"language": "python",
"trusted": true,
"collapsed": false
},
{
"metadata": {},
"cell_type": "code",
"input": "",
"outputs": [],
"language": "python",
"trusted": true,
"collapsed": false
}
],
"metadata": {}
}
],
"metadata": {
"gist_id": "3cefa7eaee5210da12ff",
"name": "",
"signature": "sha256:439f7669e31f5e45a77a523d4f197f288f2a7c7dcaffed69e8d15417720a89af"
},
"nbformat": 3
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment