Created
August 31, 2015 06:30
-
-
Save juanshishido/6437b54f08493b25afdb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "# Editing Markdown" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "This is a line of \"markdown\" is which apparently is more humble than \"markup\". It allows us to provide some text describing what we are doing with our code. \n\nTo edit this text, doubleclick into the box containing the text when viewing it in the notebook server.\n\nIt doesn't look very nice when viewed using when you are in edit mode, but after you execute the cell containing the text it looks pretty. To make all of the text on the page look nice, select the menu item Cell > Run All, or click on the sideways triangle, or type Control-return.\n \n\nSee https://help.github.com/articles/markdown-basics for details on the Markdown syntax.\n\nBe sure to do **all the tasks** listed below." | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "## Adding a Subheading" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "**Task 1.** Your first task is to add a subheading above this sentence and call it \"Adding a Subheading\". Look at the toolbar with the icons to see how to add a row. " | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "## Adding a Second Subheading" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "**Task 2.** Your second task is to add another subheading above this called \"Adding a Second Subheading\" at the same level as the one above." | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "**Task 3** There are at least three things to love about python:\n\n* interpreted\n* great at processing strings\n* <span style=\"color:red\">*great ecosystem for scientific computing*</span>\n\nIn this example we are showing you italics and bulleted lists in one fell swoop! We also used a bit of CSS code to add some color to the Markdown." | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "# Let's Write Some Code" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "Now we are going to write some code. First move your mouse into the cell below and either hit Control-enter to execute it or click on the \"Go\" triangle in the control panel above to execute it. " | |
}, | |
{ | |
"metadata": { | |
"collapsed": false, | |
"trusted": false | |
}, | |
"cell_type": "code", | |
"source": "sentence = \"The School of Information UC Berkeley’s newest school in its oldest building.\"\nsentence", | |
"execution_count": 1, | |
"outputs": [ | |
{ | |
"execution_count": 1, | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "'The School of Information UC Berkeley’s newest school in its oldest building.'" | |
}, | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "**Task 4** Write a line of code below to convert this to a list of words by breaking on white space (spaces); call this list 'sent'." | |
}, | |
{ | |
"metadata": { | |
"collapsed": false, | |
"trusted": false | |
}, | |
"cell_type": "code", | |
"source": "sent = sentence.split()", | |
"execution_count": 2, | |
"outputs": [] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "**Task 5** Using python list splicing, create a new list called 'lasttwo' that contains just the last two items from this list and return the result." | |
}, | |
{ | |
"metadata": { | |
"collapsed": false, | |
"trusted": false | |
}, | |
"cell_type": "code", | |
"source": "lastthree = sent[-3:]\nlastthree", | |
"execution_count": 4, | |
"outputs": [ | |
{ | |
"execution_count": 4, | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "['its', 'oldest', 'building.']" | |
}, | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "**Task 6** Now edit the line of code above and change it to splice out the last three words and assign to a variable called lastthree. Be sure to re-execute it and return the result. Note that you will not be creating a new input line below." | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"name": "python2", | |
"display_name": "Python 2", | |
"language": "python" | |
}, | |
"language_info": { | |
"mimetype": "text/x-python", | |
"nbconvert_exporter": "python", | |
"name": "python", | |
"pygments_lexer": "ipython2", | |
"version": "2.7.9", | |
"file_extension": ".py", | |
"codemirror_mode": { | |
"version": 2, | |
"name": "ipython" | |
} | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment