Skip to content

Instantly share code, notes, and snippets.

@jeffhussmann
Created May 17, 2013 06:09
Show Gist options
  • Save jeffhussmann/5597242 to your computer and use it in GitHub Desktop.
Save jeffhussmann/5597242 to your computer and use it in GitHub Desktop.
Activity 1
{
"metadata": {
"name": "statement_1"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": "Activity 1"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "The file `data/numbers.txt` has a million lines, each of which contains a number from 0 to 9."
},
{
"cell_type": "code",
"collapsed": false,
"input": "!wc -l data/numbers.txt",
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": "1000000 data/numbers.txt\r\n"
}
],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": "!head data/numbers.txt",
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": "0\r\n2\r\n6\r\n4\r\n1\r\n1\r\n0\r\n2\r\n0\r\n1\r\n"
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": "Main goal"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "How many times does each of the numbers appear in the file?"
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": "Stretch goal"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Make a bar graph of your answer to the main goal."
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment