Skip to content

Commit

Permalink
Added ToC to notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
TiesdeKok committed Oct 7, 2017
1 parent 35e7636 commit 7f31cb0
Show file tree
Hide file tree
Showing 6 changed files with 321 additions and 181 deletions.
84 changes: 63 additions & 21 deletions 0_python_basics.ipynb
Expand Up @@ -17,29 +17,71 @@
"**License:** MIT License "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Note:** Some features (like the ToC) will only work if you run it locally, use Binder, or use nbviewer by clicking this link: \n",
"https://nbviewer.jupyter.org/github/TiesdeKok/LearnPythonforResearch/blob/master/0_python_basics.ipynb"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# *Introduction*"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook contains an overview of basic Python functionality that you might come across using Python for Social Science Research. \n",
"The contents of this cheatsheet yield all the nescessary building blocks to use Python for basic programming. \n",
"\n",
"**Note:** this cheat sheet is purposely not 100% comprehensive, it only discusses the basic things you need to get started."
"**Note:** this notebook is purposely not 100% comprehensive, it only discusses the basic things you need to get started."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# *Table of Contents* <a id='toc'></a>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"* [Variables](#variables) \n",
"* [Displaying something](#display)\n",
"* [Numerical operations](#num-operations) \n",
"* [String operations](#string-operations) \n",
"* [Data structures](#data-structures) \n",
"* [Slicing](#slicing) \n",
"* [Functions](#functions) \n",
"* [Whitespaces](#whitespace) \n",
"* [Conditionals](#conditionals) \n",
"* [Looping](#looping) \n",
"* [Comprehensions](#comprehensions) \n",
"* [Catching exceptions](#catching-exceptions) \n",
"* [Importing libraries](#importing) \n",
"* [OS operations](#os-operations) \n",
"* [File Input / Output](#files) "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Variables"
"## <span style=\"text-decoration: underline;\">Variables</span><a id='variables'></a> [(to top)](#toc)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Basic numeric types in Python are `int` for integers and `float` for floating point numbers. \n",
"Strings are represented by `str`, in Python 3.x this implies a sequency of Unicode characters."
"Strings are represented by `str`, in Python 3.x this implies a sequence of Unicode characters."
]
},
{
Expand Down Expand Up @@ -153,7 +195,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Displaying something"
"## <span style=\"text-decoration: underline;\">Displaying something</span><a id='display'></a> [(to top)](#toc)"
]
},
{
Expand Down Expand Up @@ -219,7 +261,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Numerical operations"
"## <span style=\"text-decoration: underline;\">Numerical operations</span><a id='num-operations'></a> [(to top)](#toc)"
]
},
{
Expand Down Expand Up @@ -293,14 +335,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## String operations"
"## <span style=\"text-decoration: underline;\">String operations</span><a id='string-operations'></a> [(to top)](#toc)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Define strings with single, double or tipple quotes (for multi-line)"
"Define strings with single, double or triple quotes (for multi-line)"
]
},
{
Expand Down Expand Up @@ -436,7 +478,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Data structures"
"## <span style=\"text-decoration: underline;\">Data structures</span><a id='data-structures'></a> [(to top)](#toc)"
]
},
{
Expand Down Expand Up @@ -718,7 +760,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Slicing"
"## <span style=\"text-decoration: underline;\">Slicing</span><a id='slicing'></a> [(to top)](#toc)"
]
},
{
Expand Down Expand Up @@ -853,14 +895,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Functions"
"## <span style=\"text-decoration: underline;\">Functions</span><a id='functions'></a> [(to top)](#toc)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A Python function takes arguments as input and defines logic to processess these inputs (and possibly returns something)."
"A Python function takes arguments as input and defines logic to process these inputs (and possibly returns something)."
]
},
{
Expand Down Expand Up @@ -965,7 +1007,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Whitespace (blocks)"
"## <span style=\"text-decoration: underline;\">Whitespace (blocks)</span><a id='whitespace'></a> [(to top)](#toc)"
]
},
{
Expand Down Expand Up @@ -1019,7 +1061,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Conditionals"
"## <span style=\"text-decoration: underline;\">Conditionals</span><a id='conditionals'></a> [(to top)](#toc)"
]
},
{
Expand Down Expand Up @@ -1051,7 +1093,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Looping"
"## <span style=\"text-decoration: underline;\">Looping</span><a id='looping'></a> [(to top)](#toc)"
]
},
{
Expand Down Expand Up @@ -1207,7 +1249,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Comprehensions:"
"## <span style=\"text-decoration: underline;\">Comprehensions</span><a id='comprehensions'></a> [(to top)](#toc)"
]
},
{
Expand Down Expand Up @@ -1337,7 +1379,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Catching Exceptions"
"## <span style=\"text-decoration: underline;\">Catching Exceptions</span><a id='catching-exceptions'></a> [(to top)](#toc)"
]
},
{
Expand Down Expand Up @@ -1400,7 +1442,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"It is usually best practise to specify the error type to except:"
"It is usually best practice to specify the error type to except:"
]
},
{
Expand Down Expand Up @@ -1432,7 +1474,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Importing Libraries"
"## <span style=\"text-decoration: underline;\">Importing Libraries</span><a id='importing'></a> [(to top)](#toc)"
]
},
{
Expand Down Expand Up @@ -1502,7 +1544,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## OS operations"
"## <span style=\"text-decoration: underline;\">OS operations</span><a id='os-operations'></a> [(to top)](#toc)"
]
},
{
Expand Down Expand Up @@ -1606,7 +1648,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## File Input/Output"
"## <span style=\"text-decoration: underline;\">File Input/Output</span><a id='files'></a> [(to top)](#toc)"
]
},
{
Expand Down

0 comments on commit 7f31cb0

Please sign in to comment.