Skip to content

Instantly share code, notes, and snippets.

@Kwpolska
Created May 11, 2013 16:46
Show Gist options
  • Save Kwpolska/5560564 to your computer and use it in GitHub Desktop.
Save Kwpolska/5560564 to your computer and use it in GitHub Desktop.
Octal numbers
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "octal numbers"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": "import timeit\nn = '1234' * 50",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": "timeit.timeit(\"\"\"int('1234', 8)\"\"\") * 50",
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 2,
"text": "18.720204999999623"
}
],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": "timeit.timeit(\"\"\"int('\"\"\" + n + \"\"\"', 8)\"\"\")",
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 3,
"text": "0.7893354589996306"
}
],
"prompt_number": 3
},
{
"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